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)

Configuration

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.

Per-family transport / auth / retry / timeout configuration and the deprecation-warning codes.

Exportkindmodule
configurefunctionsrc/core/config.ts
getConfigfunctionsrc/core/config.ts
resetConfigfunctionsrc/core/config.ts
registerFamilyDefaultsfunctionsrc/core/config.ts
DEFAULT_RETRY_STATUSESconstsrc/core/config.ts
ConfigureOptionstypesrc/core/config.ts
SdvConfigtypesrc/core/config.ts
FamilyDefaultstypesrc/core/config.ts
DEPRECATED_NAME_CODEconstsrc/core/config.ts
DEPRECATED_ENDPOINT_CODEconstsrc/core/config.ts

src/core/config.ts​

Per-family transport, auth, retry budget, timeout and User-Agent; family runtimes register their defaults here.

Import: import { … } from 'sportsdataverse'

configure​

Set the transport, auth, retries, timeout or User-Agent (per family or default); calls merge.

export function configure(opts: ConfigureOptions): void

Example:

import { configure, bearerAuth } from 'sportsdataverse';
configure({ auth: { pff_api: bearerAuth(process.env.PFF_API_KEY) }, retries: 2 });

getConfig​

The current configuration.

export function getConfig(): SdvConfig

resetConfig​

Back to the defaults (registered family defaults stay).

export function resetConfig(): void

registerFamilyDefaults​

For family runtimes — install the transport / auth / retry statuses a family needs by default; a user configure entry wins.

export function registerFamilyDefaults(family: string, defaults: FamilyDefaults): void

DEFAULT_RETRY_STATUSES​

The statuses retried by default — 403, 408, 429, 500, 502, 503, 504 (sdv-py _RETRYABLE_STATUS).

export const DEFAULT_RETRY_STATUSES: readonly number[]

ConfigureOptions​

The argument of configure.

export interface ConfigureOptions

SdvConfig​

What getConfig returns.

export interface SdvConfig

FamilyDefaults​

What a family runtime registers.

export interface FamilyDefaults

DEPRECATED_NAME_CODE​

code of the DeprecationWarning a pre-v4 name emits (SDV_DEPRECATED_NAME), to filter on.

export const DEPRECATED_NAME_CODE

DEPRECATED_ENDPOINT_CODE​

code of the DeprecationWarning a deprecated endpoint emits (SDV_DEPRECATED_ENDPOINT).

export const DEPRECATED_ENDPOINT_CODE

Generated by tools/codegen/generate.mjs from tools/codegen/utilities.yaml — see How this library is built.