- Integer id columns are decimal strings — Every id column of integers (
id,*_id,game_pk,playerId, …) comes back as exact decimal strings on every surface — parsers, producers, loaders, HockeyTech analytics. Compare and join ids as strings;Number(row.game_id)for a safe number back. (changelog) - 400 / 422 raise
InvalidParameterError— For every family (it wasAssetFetchError), never retried; the message names host, path and status with a redacted excerpt of the body. (changelog) - Typed returns — generated row types for
parsed: true— TypeScript only. A wrapper's raw payload resolves tounknown(wasany); verified endpoints resolve to their row interfaces; the summary dispatchers toParsedTables. Narrow or cast a raw payload. (changelog) - Wrapper failures raise
NoDataError/AssetFetchError— Instead of raw axios errors.NoDataError= the fetch worked and there is nothing there (404, ESPN{ code: 404 });AssetFetchError= the fetch failed (403 / 429 / 5xx after retries, network). Retries followDEFAULT_RETRY_STATUSESwith backoff. (changelog)
Discovery
These utilities never fetch a provider payload by themselves — they transform, classify, configure or look things up. The data surface (every espn* / native wrapper and load* loader) is under ESPN Reference.
Index the callable surface and resolve team / athlete / game names to ESPN ids.
| Export | kind | module |
|---|---|---|
listFunctions | function | src/discover.ts |
functionCount | function | src/discover.ts |
findTeam | function | src/discover.ts |
findAthlete | function | src/discover.ts |
findEvent | function | src/discover.ts |
clearTeamCache | function | src/discover.ts |
ListFunctionsOptions | type | src/discover.ts |
Namespaces | type | src/discover.ts |
FunctionEntry | type | src/discover.ts |
src/discover.ts
Discovery and name -> id lookup (port of sdv-py discover.py / find.py), built over the live registries so renamed or new wrappers appear with no edit.
Import: import { … } from 'sportsdataverse'
listFunctions
Index of callable functions — a sorted name array for one namespace, or an object keyed by namespace; search filters, parsersOnly / wrappersOnly narrow; each entry is labelled data or utility (with its category) through listFunctions(ns, \{ detail: true \}).
export async function listFunctions( league: string | null | undefined, opts: ListFunctionsOptions & { detail: true }, ns?: Namespaces, ): Promise<FunctionEntry[] | Record<string, FunctionEntry[]>>;
Aliases: list_functions
Example:
const fns = await sdv.listFunctions('nba', { search: 'roster' });
functionCount
Number of callable functions per namespace, or in one.
export async function functionCount( league?: string | null, ns?: Namespaces, ): Promise<number | Record<string, number>>
Aliases: function_count
findTeam
Resolve a team name / abbreviation (case-insensitive substring) to ESPN team metadata.
export async function findTeam( name: string, league: string, opts: { multi?: boolean }
Aliases: find_team
findAthlete
Resolve an athlete name through team rosters (team narrows to one roster).
export async function findAthlete( name: string, league: string, opts: { team?: string; multi?: boolean }
Aliases: find_athlete
findEvent
Resolve a game on a date to its ESPN event, optionally by home / away team.
export async function findEvent( date: string, league: string, opts: { home?: string; away?: string; multi?: boolean }
Aliases: find_event
clearTeamCache
Reset the in-process team-list cache (one league, or all).
export function clearTeamCache(league?: string): void
Aliases: clear_team_cache
ListFunctionsOptions
Options of listFunctions.
export interface ListFunctionsOptions
Namespaces
The namespace map listFunctions indexes (default - the package default export).
export type Namespaces
FunctionEntry
A detailed listFunctions row — \{ name, kind, category? \}.
export interface FunctionEntry
Generated by tools/codegen/generate.mjs from tools/codegen/utilities.yaml — see How this library is built.