Skip to main content
Breaking in 4.0.0
  • 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 was AssetFetchError), 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 to unknown (was any); verified endpoints resolve to their row interfaces; the summary dispatchers to ParsedTables. 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 follow DEFAULT_RETRY_STATUSES with backoff. (changelog)

Discovery

Not data functions

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.

Exportkindmodule
listFunctionsfunctionsrc/discover.ts
functionCountfunctionsrc/discover.ts
findTeamfunctionsrc/discover.ts
findAthletefunctionsrc/discover.ts
findEventfunctionsrc/discover.ts
clearTeamCachefunctionsrc/discover.ts
ListFunctionsOptionstypesrc/discover.ts
Namespacestypesrc/discover.ts
FunctionEntrytypesrc/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.