Skip to content

@univ-lehavre/atlas-openalex-types ​

TypeScript types, branded types, and API response interfaces for the OpenAlex API.

Installation ​

bash
pnpm add @univ-lehavre/atlas-openalex-types

Usage ​

typescript
import { asORCID, asOpenAlexID, type ORCID, type OpenAlexID } from '@univ-lehavre/atlas-openalex-types';

const orcid: ORCID = asORCID('https://orcid.org/0000-0001-2345-6789');
const id: OpenAlexID = asOpenAlexID('https://openalex.org/A123456789');

API ​

Branded types ​

ExportDescription
ORCIDBranded string for ORCID identifiers
OpenAlexIDBranded string for OpenAlex identifiers
asORCID(value)Casts a string to ORCID
asOpenAlexID(value)Casts a string to OpenAlexID

API response types ​

ExportDescription
AuthorsResultSingle author result from /authors
AffiliationsResultAuthor affiliation entry
WorksResultSingle work result from /works
IInstitutionInstitution object
AuthorshipInstitutionInstitution within an authorship
OpenalexResponse<T>Paginated API response wrapper
RateLimitInfoRate-limit headers parsed from responses

API parameter types ​

ExportDescription
FetchOpenAlexAPIOptionsQuery parameters for OpenAlex API requests (includes api_key, search, filter, sort, etc.)

Interfaces ​

InterfaceDescription
AffiliationsResult-
AuthorshipInstitution-
AuthorsResult-
FetchOpenAlexAPIOptions-
IInstitution-
OpenalexResponse-
RateLimitInfo-
WorksResult-

Type Aliases ​

Type AliasDescription
OpenAlexID-
ORCID-

Variables ​

VariableDescription
asOpenAlexIDBranded constructor for OpenAlex entity identifiers.
asORCIDBranded constructor for ORCID identifiers.