JS SDK v1.128.0
about 3 hours ago by Viktor Yordanov
Added
- Sports namespace with getCompetitionById(competitionId, filters?, disableCache?) — sport-agnostic competition reads.
filtersis an optional CompetitionByIdFilters object- Returns a fully-populated CompetitionModel (competition + optional season, stages and standings).
- HTTP response caching (stale-while-revalidate) for Sports and Search reads:
- Fresh → served instantly with no network call; stale → served instantly while revalidating in the background (deduplicated, serves stale on error); miss → blocking fetch.
- Revalidation via
Last-Modified/If-Modified-Since(304-aware). Sports TTL is driven by the responseExpiresheader.- Multi-runtime storage backends: browser (in-memory L1 + IndexedDB L2), server
node-cache), React Native (in-memory L1 + AsyncStorage L2), all degrading gracefully to memory-only.- Configurable cache TTLs via the new
cacheconfig optionconfig.cache.search), overriding the per-entity defaults.- Automatic competition enrichment (on cache-miss): the competition entity, each stage's
stageNameModel, and each standing'scompetitorModelare resolved from the Search API and attached to the response.- Localization of enriched entity
name/shortNameusingconfig.lang, falling back to the original value when no matching translation existsstatscoreadded as a supported idSchema type in the SDK configuration.- New Sports/Search models: CompetitionModel, CompetitionEntityModel, CompetitorModel, StageNameModel, SeasonModel, and related sub-models.
disableCachealso busts the server cache
