/** * OpenAlex (https://openalex.org): CC0 metadata for about 250 million works. * * `search=` matches title, abstract and full text, with quoted phrases and * AND / OR / NOT. Without a key the API gives 1000 credits a day: a search * costs 10, a lookup by ID or DOI costs nothing. A free key from * openalex.org/settings/api raises that; set OPENALEX_API_KEY or put it in the * keychain (see apiKey in core.ts). */ import { type PaperContext } from "./core.js"; import type { PaperRecord } from "./records.js"; type Location = { landing_page_url?: string | null; pdf_url?: string | null; license?: string | null; version?: string | null; is_oa?: boolean; source?: { display_name?: string | null; type?: string | null; } | null; raw_source_name?: string | null; }; export type OpenAlexWork = { id: string; doi?: string | null; display_name?: string | null; publication_year?: number | null; publication_date?: string | null; type?: string | null; authorships?: Array<{ author?: { display_name?: string | null; } | null; raw_author_name?: string | null; }>; primary_location?: Location | null; locations?: Location[]; best_oa_location?: Location | null; open_access?: { is_oa?: boolean; oa_status?: string | null; } | null; cited_by_count?: number | null; abstract_inverted_index?: Record | null; }; /** OpenAlex ships abstracts as word -> positions. Put the words back in order. */ export declare function rebuildAbstract(index: Record | null | undefined): string | undefined; export declare function fromOpenAlex(work: OpenAlexWork): PaperRecord; /** A note when the day's free credits run low, read from the reply headers. */ export declare function creditNote(headers: Headers): string | undefined; export type OpenAlexSearch = { records: PaperRecord[]; total: number; note?: string; }; export declare function searchOpenAlex(ctx: PaperContext, query: string, options: { limit: number; yearFrom?: number; yearTo?: number; }): Promise; /** Look up one work by DOI or OpenAlex ID (free of credits). Null when OpenAlex has no record. */ export declare function getOpenAlexWork(ctx: PaperContext, id: { doi: string; } | { openalex: string; }): Promise; export {};