@ufcalendar/sdk 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # @ufcalendar/sdk — TypeScript client for the UFCalendar Fight API
1
+ # @ufcalendar/sdk — MMA Fight Data API client for TypeScript
2
2
 
3
- The [UFCalendar Fight API](https://www.ufcalendar.com/developers) is a REST API for MMA data: **UFC, PFL, OKTAGON, BKFC and RIZIN** events, full fight cards, results within minutes, per-fight and round-by-round statistics, complete fighter careers, the only **MMA data API with point-in-time UFC rankings history back to 2013**, and the only one serving **judges' scorecards** — every official, every round — plus the **UFCalendar consensus odds line** (current, opening and closing on every plan, line movement on Pro). This package is a dependency-free `fetch` wrapper over it: one method per endpoint, cursor pagination handled for you, ESM + CJS, Node 18+, browsers and edge runtimes.
3
+ UFC, PFL, OKTAGON, BKFC and RIZIN events, fight stats, results, rankings history and judges' scorecards from one typed client.
4
+
5
+ The [MMA Fight Data API by UFCalendar](https://www.ufcalendar.com/developers) (the UFCalendar Fight API) is a REST API for MMA data: **UFC, PFL, OKTAGON, BKFC and RIZIN** events, full fight cards, results within minutes, per-fight and round-by-round statistics, complete fighter careers, the only **MMA data API with point-in-time UFC rankings history back to 2013**, and the only one serving **judges' scorecards** — every official, every round — plus the **UFCalendar consensus odds line** (current, opening and closing on every plan, line movement on Pro). This package is a dependency-free `fetch` wrapper over it: one method per endpoint, cursor pagination handled for you, ESM + CJS, Node 18+, browsers and edge runtimes.
4
6
 
5
7
  ```bash
6
8
  npm install @ufcalendar/sdk
@@ -8,6 +10,14 @@ npm install @ufcalendar/sdk
8
10
 
9
11
  Get a key (free 1-day trial, 100 requests, no card) at <https://www.ufcalendar.com/account/api?trial=1>. Paid plans from $19/month for 30,000 requests (Pro $49 for 200,000, Business $149 for 1,000,000) — hard caps, no overage.
10
12
 
13
+ ## Quickstart in 3 lines
14
+
15
+ ```ts
16
+ import { FightAPI } from '@ufcalendar/sdk';
17
+ const api = new FightAPI('ufcalendar_...'); // free 1-day trial key, no card
18
+ for await (const ev of api.events({ org: 'ufc', limit: 1 })) console.log(ev.title); // the next UFC card
19
+ ```
20
+
11
21
  ## Quickstart
12
22
 
13
23
  ```ts
package/dist/index.cjs CHANGED
@@ -28,7 +28,7 @@ __export(index_exports, {
28
28
  module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/version.ts
31
- var VERSION = "0.7.0";
31
+ var VERSION = "0.8.1";
32
32
 
33
33
  // src/client.ts
34
34
  var DEFAULT_BASE_URL = "https://api.ufcalendar.com/v1";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { FightAPI, FightAPIError, DEFAULT_BASE_URL } from './client';\nexport type { FightAPIOptions, Query, QueryValue } from './client';\nexport { VERSION } from './version';\nexport type * from './types';\n/** The generated OpenAPI path map, for anything the hand-written types above\n * do not cover. Regenerated by `pnpm gen:types` from apps/api/openapi.json. */\nexport type { paths, operations } from './schema';\n","/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.7.0';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n let res: Response;\n try {\n res = await this.#fetch(this.#url(path, params), {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n const text = await res.text();\n let parsed: unknown = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans, quotas, the free 1-day trial rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /** Per-fight totals for both corners. */\n fightStats(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAU;;;AC2EhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAkBpB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAc,SAAiB,YAA2B,MAAM;AAC1F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AAA;AAAA;AAAA;AAAA,EASA,MAAM,sBAAsB,KAAa,QAA6C;AACpF,UAAM,OAAgC,EAAE,IAAI;AAC5C,QAAI,QAAQ,OAAQ,MAAK,SAAS;AAClC,YAAQ,MAAM,KAAK,SAA0B,QAAQ,qBAAqB,EAAE,KAAK,CAAC,GAAG;AAAA,EACvF;AAAA,EAEA,MAAM,sBAAsB,YAA4C;AACtE,UAAM,KAAK,SAAkB,UAAU,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC,EAAE;AAAA,EACtG;AAAA,EAEA,MAAM,oBAAoB,YAAuD;AAC/E,YACE,MAAM,KAAK;AAAA,MACT;AAAA,MACA,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC;AAAA,IAC7D,GACA;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/version.ts","../src/client.ts"],"sourcesContent":["export { FightAPI, FightAPIError, DEFAULT_BASE_URL } from './client';\nexport type { FightAPIOptions, Query, QueryValue } from './client';\nexport { VERSION } from './version';\nexport type * from './types';\n/** The generated OpenAPI path map, for anything the hand-written types above\n * do not cover. Regenerated by `pnpm gen:types` from apps/api/openapi.json. */\nexport type { paths, operations } from './schema';\n","/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.8.1';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n let res: Response;\n try {\n res = await this.#fetch(this.#url(path, params), {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n const text = await res.text();\n let parsed: unknown = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans, quotas, the free 1-day trial rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /** Per-fight totals for both corners. */\n fightStats(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,UAAU;;;AC2EhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAkBpB,IAAM,gBAAN,cAA4B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AAAA;AAAA,EAIA,mBAA+C;AAC7C,WAAO,KAAK,IAAuB,mBAAmB;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,sBAAsB,KAAa,QAA6C;AACpF,UAAM,OAAgC,EAAE,IAAI;AAC5C,QAAI,QAAQ,OAAQ,MAAK,SAAS;AAClC,YAAQ,MAAM,KAAK,SAA0B,QAAQ,qBAAqB,EAAE,KAAK,CAAC,GAAG;AAAA,EACvF;AAAA,EAEA,MAAM,sBAAsB,YAA4C;AACtE,UAAM,KAAK,SAAkB,UAAU,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC,EAAE;AAAA,EACtG;AAAA,EAEA,MAAM,oBAAoB,YAAuD;AAC/E,YACE,MAAM,KAAK;AAAA,MACT;AAAA,MACA,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC;AAAA,IAC7D,GACA;AAAA,EACJ;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1116,8 +1116,8 @@ interface YearStats {
1116
1116
  interface Plan {
1117
1117
  key: string;
1118
1118
  name: string;
1119
- price_monthly_usd: number | null;
1120
- price_yearly_usd: number | null;
1119
+ price_monthly_usd: number;
1120
+ price_yearly_usd: number;
1121
1121
  requests_per_month: number;
1122
1122
  rpm: number;
1123
1123
  key_limit: number;
@@ -1134,9 +1134,6 @@ interface Plans {
1134
1134
  per_account: number;
1135
1135
  start_url: string;
1136
1136
  };
1137
- enterprise: {
1138
- contact: string;
1139
- };
1140
1137
  mcp: {
1141
1138
  url: string;
1142
1139
  transport: string;
@@ -1697,7 +1694,7 @@ declare class FightAPI {
1697
1694
 
1698
1695
  /** Kept in lockstep with package.json and the User-Agent by
1699
1696
  * `apps/api/src/surfaces.test.ts`. Bump all three together. */
1700
- declare const VERSION = "0.7.0";
1697
+ declare const VERSION = "0.8.1";
1701
1698
 
1702
1699
  /**
1703
1700
  * This file was auto-generated by openapi-typescript.
@@ -1755,9 +1752,6 @@ interface paths {
1755
1752
  * "per_account": 1,
1756
1753
  * "start_url": "https://www.ufcalendar.com/account/api?trial=1"
1757
1754
  * },
1758
- * "enterprise": {
1759
- * "contact": "api@ufcalendar.com"
1760
- * },
1761
1755
  * "mcp": {
1762
1756
  * "url": "https://api.ufcalendar.com/mcp",
1763
1757
  * "transport": "streamable-http",
@@ -3617,7 +3611,7 @@ interface paths {
3617
3611
  };
3618
3612
  /**
3619
3613
  * Search completed bouts (filtered)
3620
- * @description Completed bouts with a winner across the launch promotions, filtered — the one-call answer to "the last title fight to end by knockout" or "every submission win for this fighter". **At least one narrowing filter is required** (`title_only`, `method`, `division`, `fighter`, `winner`, `from`, `to`, `main_events_only`; `org`, `order`, `limit` and `cursor` do not count) — a bare call 400s `filter_required`, because the whole table is the Enterprise bulk snapshot, not a list endpoint. Newest first by default (`order=oldest` reverses it); inside one card the main event comes first, then card order. Up to 25 rows per page and at most 10 pages deep (`page_depth_exceeded` past that — narrow the filters). Each row is the bout (same shape as `/v1/fights/{id}`) plus its `event` (`id`, `slug`, `title`, `org`, `starts_at`); `meta.filters` echoes the filters applied. `fighter`/`winner` take a slug or id (404 when not on the roster).
3614
+ * @description Completed bouts with a winner across the launch promotions, filtered — the one-call answer to "the last title fight to end by knockout" or "every submission win for this fighter". **At least one narrowing filter is required** (`title_only`, `method`, `division`, `fighter`, `winner`, `from`, `to`, `main_events_only`; `org`, `order`, `limit` and `cursor` do not count) — a bare call 400s `filter_required`, because the whole table is not sold as a list or a bulk export on any plan. Newest first by default (`order=oldest` reverses it); inside one card the main event comes first, then card order. Up to 25 rows per page and at most 10 pages deep (`page_depth_exceeded` past that — narrow the filters). Each row is the bout (same shape as `/v1/fights/{id}`) plus its `event` (`id`, `slug`, `title`, `org`, `starts_at`); `meta.filters` echoes the filters applied. `fighter`/`winner` take a slug or id (404 when not on the roster).
3621
3615
  */
3622
3616
  get: {
3623
3617
  parameters: {
@@ -5671,7 +5665,7 @@ interface paths {
5671
5665
  };
5672
5666
  /**
5673
5667
  * Fighter profile
5674
- * @description Bio, records, stats, UFCalendar Power Index summary, and CC-licensed images with attribution metadata (displaying the credit is a license requirement). **Read `records` and `stats`** (added 2026-09-24): `records` is a map keyed by a clean name — `pro_mma` (the career MMA record), `amateur_mma`, `pro_kickboxing`, …, and the org slug for a record INSIDE one promotion (`ufc`, `one`, `bkfc`) — each `{ value, source, scope }`; `stats` is ONE per-minute panel (SLpM, striking accuracy/defense, SApM, takedown average/accuracy/defense, submission average), always the widest sample UFCalendar holds, with `basis: { bouts, orgs, source, scope }` stating exactly which bouts it averages over (e.g. 7 UFC bouts, or 18 across UFC + Oktagon); `null` when no real panel exists. `career_stats` is the raw per-source row list these are built from and stays unchanged for existing integrations.
5668
+ * @description Bio, records, stats, UFCalendar Power Index summary, and CC-licensed images with attribution metadata (displaying the credit is a license requirement). **Read `records` and `stats`** (added 2026-09-24): `records` is a map keyed by a clean name — `pro_mma` (the career MMA record), `amateur_mma`, `pro_kickboxing`, …, and the org slug for a record INSIDE one promotion (`ufc`, `one`, `bkfc`) — each `{ value, source, scope }`; `stats` is ONE per-minute panel (SLpM, striking accuracy/defense, SApM, takedown average/accuracy/defense, submission average), always the widest sample UFCalendar holds (the `pro-mma` panel: every promotion; `tracked` for a fighter with no MMA career, e.g. a Muay Thai athlete), with `basis: { bouts, orgs, source, scope }` stating exactly which bouts it averages over (e.g. 7 UFC bouts, or 18 across UFC + Oktagon); `null` when no real panel exists. `career_stats` is the raw per-source row list these are built from and stays unchanged for existing integrations.
5675
5669
  *
5676
5670
  * `next_fight` is the fighter's next booked bout (not completed or cancelled, on an event that has not been cancelled and started no more than ~6h ago; `result` is always null) and `last_fight` their most recent completed or no-contest bout — both in the same shape as a `source: "native"` row of `/history`, or `null`.
5677
5671
  *
@@ -5732,6 +5726,15 @@ interface paths {
5732
5726
  * "team": "Chute Boxe Diego Lima",
5733
5727
  * "birthplace": "Guarujá, Brazil",
5734
5728
  * "records": {
5729
+ * "pro_mma": {
5730
+ * "value": "37-11-0 (1 NC)",
5731
+ * "wins": 37,
5732
+ * "losses": 11,
5733
+ * "draws": 0,
5734
+ * "no_contests": 1,
5735
+ * "source": "public-records",
5736
+ * "scope": "pro-mma"
5737
+ * },
5735
5738
  * "ufc": {
5736
5739
  * "value": "25-11-0 (1 NC)",
5737
5740
  * "wins": 25,
@@ -5766,12 +5769,25 @@ interface paths {
5766
5769
  * "orgs": [
5767
5770
  * "ufc"
5768
5771
  * ],
5769
- * "source": "ufc-stats",
5770
- * "scope": "ufc-only"
5772
+ * "source": "ufcalendar",
5773
+ * "scope": "pro-mma"
5771
5774
  * }
5772
5775
  * },
5773
5776
  * "career_stats": [
5774
5777
  * {
5778
+ * "scope": "pro-mma",
5779
+ * "source": "public-records",
5780
+ * "record": "37-11-0 (1 NC)",
5781
+ * "slpm": "3.23",
5782
+ * "str_acc": "55%",
5783
+ * "sapm": "3.05",
5784
+ * "str_def": null,
5785
+ * "td_avg": "2.29",
5786
+ * "td_acc": "39%",
5787
+ * "td_def": "54%",
5788
+ * "sub_avg": null
5789
+ * },
5790
+ * {
5775
5791
  * "scope": "ufc-only",
5776
5792
  * "source": "ufc-stats",
5777
5793
  * "record": "25-11-0 (1 NC)",
@@ -6128,7 +6144,7 @@ interface paths {
6128
6144
  };
6129
6145
  /**
6130
6146
  * Career statistics
6131
- * @description Raw per-source career rows, plus the readable split in `meta.records` / `meta.stats` (the same objects the fighter profile carries — read those unless you need the per-source rows). `data`: per-scope career stats (`pro-mma`, `amateur-mma`, …): record, strikes landed/absorbed per minute, accuracy/defense, takedown and submission averages, and `updated_at` (this route only). Exactly ONE row per scope; `source` names the publisher it came from: `public-records` (the complete multi-promotion career record) is preferred, then the promotion's own site (`ufc-stats`, `bkfc-official`, `one-official`, …), then `ufcalendar`. A `public-records` record is a point-in-time snapshot advanced by every settled bout UFCalendar tracked after it, so it matches the record on ufcalendar.com. Org-scoped rows (`ufc-only`, `bkfc-only`, `one-only`) are the fighter's record INSIDE that promotion, not a career record: `ufc-only` pairs ufcstats' UFC-bouts-only striking/grappling averages with a record UFCalendar derives from the fighter's tracked UFC bouts (Contender Series excluded, `W-L-D` plus ` (n NC)`; null until a UFC bout is settled), while `bkfc-only` / `one-only` carry the promotion's own published record. ufcstats', OKTAGON's and ACA's header records are CAREER records and ship under `pro-mma` (the `public-records` row wins the scope when present, unless ufcstats counts more bouts). Scope `tracked` rows are computed by UFCalendar from per-fight totals when no published panel carries data (e.g. Contender Series debutants, PFL/OKTAGON rosters); their `record` is always null.
6147
+ * @description Raw per-source career rows, plus the readable split in `meta.records` / `meta.stats` (the same objects the fighter profile carries — read those unless you need the per-source rows). `data`: per-scope career stats (`pro-mma`, `amateur-mma`, …): record, strikes landed/absorbed per minute, accuracy/defense, takedown and submission averages, and `updated_at` (this route only). Exactly ONE row per scope; `source` names the publisher it came from: `public-records` (the complete multi-promotion career record) is preferred, then the promotion's own site (`ufc-stats`, `bkfc-official`, `one-official`, …), then `ufcalendar`. A `public-records` record is a point-in-time snapshot advanced by every settled bout UFCalendar tracked after it, so it matches the record on ufcalendar.com. A row's record and its stats cover the same bouts. `pro-mma` = the career record plus striking/grappling averages UFCalendar computes over EVERY settled bout it holds per-fight totals for, in any promotion (Contender Series included); its stats are null when no such bout exists. Org-scoped rows (`ufc-only`, `bkfc-only`, `one-only`) are the fighter's record INSIDE that promotion, not a career record: `ufc-only` carries a record AND averages UFCalendar derives from the fighter's tracked UFC bouts only (Contender Series excluded, `W-L-D` plus ` (n NC)`; both null until a UFC bout is settled — a Contender-Series-only fighter has no UFC stats), while `bkfc-only` / `one-only` carry the promotion's own published record. A fighter whose records show no MMA career at all (a ONE Muay Thai or kickboxing athlete) carries the every-promotion averages on a `tracked` row (null record) instead of `pro-mma`, because those bouts are not MMA. ufcstats', OKTAGON's and ACA's header records are CAREER records and ship under `pro-mma` (the `public-records` row wins the scope when present, unless ufcstats counts more bouts).
6132
6148
  */
6133
6149
  get: {
6134
6150
  parameters: {
@@ -9669,7 +9685,7 @@ interface paths {
9669
9685
  put?: never;
9670
9686
  /**
9671
9687
  * Register a webhook endpoint
9672
- * @description Pro+. Body: `{"url": "https://...", "events": ["event.announced", "fight.result", "card.changed", "event.completed", "odds.moved"]}`. Subscribe to `event.announced` and you do not need to poll `/v1/events` to discover new cards — it fires once, within a minute of a card first landing in our data, and carries the same event object the list endpoint returns. `odds.moved` fires when the UFCalendar consensus line on an upcoming bout moves at least 5 implied-probability points on corner a, or the favourite flips, measured against the last line we delivered for that bout (its opening line before the first delivery), so a slow drift arrives once, not per refresh: `data` is `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}`. Information only, not betting advice. The response contains the signing `secret` ONCE. Every delivery body is `{"id", "type", "data", "sent_at"}` (`WebhookDelivery` schema) — `id` is stable across retries, so deduplicate on it. Deliveries carry `X-UFCalendar-Signature: t=<unix>,v1=<hmac>` where the HMAC-SHA256 input is `"<t>.<rawBody>"`. **Verify the timestamp too**: reject anything where `|now - t|` exceeds 300 seconds, otherwise a captured delivery can be replayed at you forever with a valid HMAC. Delivery is at-least-once — expect a retry roughly every 60s until your endpoint returns 2xx. Endpoints auto-disable after 20 consecutive failures, and you may hold at most 3 active endpoints (409 `endpoint_limit`). Latency: results are dispatched within ~1 minute of the result being recorded. `event.announced` only fires for cards that have not started yet, so archive backfills never reach you as new-card noise. `card.changed` is filtered the same way: a change whose before and after read identically (a venue row re-minted for the same arena, a source dropping a sub-time it never knew) is never delivered, and when a source flip-flops a value we deliver the move and its undo once, not the twentieth repeat. Deliveries are free — they never count against your monthly request quota, only the calls you make to manage endpoints do.
9688
+ * @description Pro+. Body: `{"url": "https://...", "events": ["event.announced", "fight.result", "card.changed", "event.completed", "odds.moved"]}`. Subscribe to `event.announced` and you do not need to poll `/v1/events` to discover new cards — it fires once, within a minute of a card first landing in our data, and carries the same event object the list endpoint returns. `fight.result` fires once per bout within a minute of the result, as `revision` 1, and again as the next revision (`corrected: true`, with the `previous` result) whenever the winner, method, round, time or status is corrected in the 72 h after it — upsert on `fight_id` and keep the highest `revision`. `odds.moved` fires when the UFCalendar consensus line on an upcoming bout moves at least 5 implied-probability points on corner a, or the favourite flips, measured against the last line we delivered for that bout (its opening line before the first delivery), so a slow drift arrives once, not per refresh: `data` is `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}`. Information only, not betting advice. The response contains the signing `secret` ONCE. Every delivery body is `{"id", "type", "data", "sent_at"}` (`WebhookDelivery` schema) — `id` is stable across retries, so deduplicate on it. Deliveries carry `X-UFCalendar-Signature: t=<unix>,v1=<hmac>` where the HMAC-SHA256 input is `"<t>.<rawBody>"`. **Verify the timestamp too**: reject anything where `|now - t|` exceeds 300 seconds, otherwise a captured delivery can be replayed at you forever with a valid HMAC. Delivery is at-least-once — expect a retry roughly every 60s until your endpoint returns 2xx. Endpoints auto-disable after 20 consecutive failures, and you may hold at most 3 active endpoints (409 `endpoint_limit`). Latency: results are dispatched within ~1 minute of the result being recorded. `event.announced` only fires for cards that have not started yet, so archive backfills never reach you as new-card noise. `card.changed` is filtered the same way: a change whose before and after read identically (a venue row re-minted for the same arena, a source dropping a sub-time it never knew) is never delivered, and when a source flip-flops a value we deliver the move and its undo once, not the twentieth repeat. Deliveries are free — they never count against your monthly request quota, only the calls you make to manage endpoints do.
9673
9689
  */
9674
9690
  post: {
9675
9691
  parameters: {
@@ -9993,91 +10009,6 @@ interface paths {
9993
10009
  patch?: never;
9994
10010
  trace?: never;
9995
10011
  };
9996
- "/v1/bulk/{kind}": {
9997
- parameters: {
9998
- query?: never;
9999
- header?: never;
10000
- path?: never;
10001
- cookie?: never;
10002
- };
10003
- /**
10004
- * Bulk snapshot (Enterprise only)
10005
- * @description Enterprise only — the full dataset is licensed, not self-serve; contact api@ufcalendar.com. Downloads the full launch-scope dataset as gzipped JSON: `events.json.gz`, `fights.json.gz`, `fighters.json.gz` or `odds-closing.json.gz` (the closing-line archive: one row per priced, settled bout since 2012 with `fight_id`, `event_id`, `event_slug`, `org`, `starts_at`, `fighter_a_id`, `fighter_b_id`, `winner_fighter_id`, `opening_a` / `opening_b` / `opening_at`, `closing_a` / `closing_b` / `closing_at` as American moneylines, and `sources`; UFCalendar consensus only, no book identities, information only). Responds 302 to a presigned URL; snapshots regenerate at most every 6 hours. One request per download (the redirect is free).
10006
- */
10007
- get: {
10008
- parameters: {
10009
- query?: never;
10010
- header?: never;
10011
- path: {
10012
- kind: "events.json.gz" | "fights.json.gz" | "fighters.json.gz" | "odds-closing.json.gz";
10013
- };
10014
- cookie?: never;
10015
- };
10016
- requestBody?: never;
10017
- responses: {
10018
- /** @description Redirect to a time-limited download URL */
10019
- 302: {
10020
- headers: {
10021
- Location?: string;
10022
- [name: string]: unknown;
10023
- };
10024
- content?: never;
10025
- };
10026
- /** @description Missing/invalid API key (`unauthorized`). */
10027
- 401: {
10028
- headers: {
10029
- [name: string]: unknown;
10030
- };
10031
- content: {
10032
- "application/json": components["schemas"]["Error"];
10033
- };
10034
- };
10035
- /** @description Requires an Enterprise agreement (`tier_required`). */
10036
- 403: {
10037
- headers: {
10038
- [name: string]: unknown;
10039
- };
10040
- content: {
10041
- "application/json": components["schemas"]["Error"];
10042
- };
10043
- };
10044
- /** @description Not found (`not_found`; staged-org data 404s until the org is promoted). */
10045
- 404: {
10046
- headers: {
10047
- [name: string]: unknown;
10048
- };
10049
- content: {
10050
- "application/json": components["schemas"]["Error"];
10051
- };
10052
- };
10053
- /** @description Rate limited (`rate_limited`) or monthly quota reached (`quota_exceeded`). Honor `Retry-After`. */
10054
- 429: {
10055
- headers: {
10056
- [name: string]: unknown;
10057
- };
10058
- content: {
10059
- "application/json": components["schemas"]["Error"];
10060
- };
10061
- };
10062
- /** @description Something broke on our side (`internal_error`). It has been logged under the `request_id`. */
10063
- 500: {
10064
- headers: {
10065
- [name: string]: unknown;
10066
- };
10067
- content: {
10068
- "application/json": components["schemas"]["Error"];
10069
- };
10070
- };
10071
- };
10072
- };
10073
- put?: never;
10074
- post?: never;
10075
- delete?: never;
10076
- options?: never;
10077
- head?: never;
10078
- patch?: never;
10079
- trace?: never;
10080
- };
10081
10012
  "/v1/usage": {
10082
10013
  parameters: {
10083
10014
  query?: never;
@@ -10249,7 +10180,7 @@ interface components {
10249
10180
  * @description Plan tier.
10250
10181
  * @enum {string}
10251
10182
  */
10252
- Tier: "trial" | "hobby" | "pro" | "business" | "enterprise";
10183
+ Tier: "trial" | "hobby" | "pro" | "business";
10253
10184
  /**
10254
10185
  * @description Webhook event types.
10255
10186
  * @enum {string}
@@ -10800,8 +10731,9 @@ interface components {
10800
10731
  bouts: number;
10801
10732
  /** @description Org slugs those bouts span. */
10802
10733
  orgs: string[];
10803
- /** @description `ufcalendar` (computed by UFCalendar from per-fight totals) or `ufc-stats` (ufcstats.com's UFC-only panel). */
10734
+ /** @description `ufcalendar` for the every-promotion panel, else the `ufc-only` row's source. Both are computed by UFCalendar from per-fight totals. */
10804
10735
  source: string;
10736
+ /** @description `pro-mma` (every settled bout with per-fight totals, any promotion) or `ufc-only` (UFC bouts only, Contender Series excluded). */
10805
10737
  scope: string;
10806
10738
  };
10807
10739
  /** @description ONE per-minute panel: the widest sample UFCalendar holds for the fighter. */
@@ -10845,7 +10777,7 @@ interface components {
10845
10777
  };
10846
10778
  /** @description Raw per-source career row, exactly one per scope. */
10847
10779
  CareerStatRow: {
10848
- /** @description `pro-mma`, `amateur-mma`, `pro-kickboxing`, …, `ufc-only` / `bkfc-only` / `one-only`, or `tracked`. */
10780
+ /** @description `pro-mma`, `amateur-mma`, `pro-kickboxing`, …, or `ufc-only` / `bkfc-only` / `one-only`. */
10849
10781
  scope: string;
10850
10782
  /** @description Who published the record: `ufc-stats` (ufcstats.com), a promotion's own site (`ufc-official`, `bkfc-official`, `one-official`, `oktagon-official`, …), `ufcalendar` (derived by UFCalendar), or `public-records` (the complete multi-promotion career record compiled from public records). */
10851
10783
  source: string;
@@ -12174,9 +12106,8 @@ interface components {
12174
12106
  Plan: {
12175
12107
  key: components["schemas"]["Tier"];
12176
12108
  name: string;
12177
- /** @description Null for Enterprise (contract). */
12178
- price_monthly_usd: number | null;
12179
- price_yearly_usd: number | null;
12109
+ price_monthly_usd: number;
12110
+ price_yearly_usd: number;
12180
12111
  requests_per_month: number;
12181
12112
  rpm: number;
12182
12113
  key_limit: number;
@@ -12193,9 +12124,6 @@ interface components {
12193
12124
  per_account: number;
12194
12125
  start_url: string;
12195
12126
  };
12196
- enterprise: {
12197
- contact: string;
12198
- };
12199
12127
  mcp: {
12200
12128
  url: string;
12201
12129
  transport: string;
@@ -12239,7 +12167,7 @@ interface components {
12239
12167
  /** @description Delivery id (stable across retries — deduplicate on it). */
12240
12168
  id: string;
12241
12169
  type: components["schemas"]["WebhookKind"];
12242
- /** @description `event.announced` / `event.completed`: `{event}` (the list-shape event); `fight.result`: the bout with `event` and `result`; `card.changed`: `{event, change}`; `odds.moved`: `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}` (UFCalendar consensus line, information only, not betting advice). */
12170
+ /** @description `event.announced` / `event.completed`: `{event}` (the list-shape event); `fight.result`: the bout with `event`, `result`, `revision` and `corrected` — `revision` 1 is the first delivery; if the winner, method, round, time or status changes within 72 h of the result, the bout is re-sent as the next revision with `corrected: true` and the `previous` result it replaces (upsert on `fight_id`, keep the highest `revision`); `card.changed`: `{event, change}`; `odds.moved`: `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}` (UFCalendar consensus line, information only, not betting advice). */
12243
12171
  data: {
12244
12172
  [key: string]: unknown;
12245
12173
  };
package/dist/index.d.ts CHANGED
@@ -1116,8 +1116,8 @@ interface YearStats {
1116
1116
  interface Plan {
1117
1117
  key: string;
1118
1118
  name: string;
1119
- price_monthly_usd: number | null;
1120
- price_yearly_usd: number | null;
1119
+ price_monthly_usd: number;
1120
+ price_yearly_usd: number;
1121
1121
  requests_per_month: number;
1122
1122
  rpm: number;
1123
1123
  key_limit: number;
@@ -1134,9 +1134,6 @@ interface Plans {
1134
1134
  per_account: number;
1135
1135
  start_url: string;
1136
1136
  };
1137
- enterprise: {
1138
- contact: string;
1139
- };
1140
1137
  mcp: {
1141
1138
  url: string;
1142
1139
  transport: string;
@@ -1697,7 +1694,7 @@ declare class FightAPI {
1697
1694
 
1698
1695
  /** Kept in lockstep with package.json and the User-Agent by
1699
1696
  * `apps/api/src/surfaces.test.ts`. Bump all three together. */
1700
- declare const VERSION = "0.7.0";
1697
+ declare const VERSION = "0.8.1";
1701
1698
 
1702
1699
  /**
1703
1700
  * This file was auto-generated by openapi-typescript.
@@ -1755,9 +1752,6 @@ interface paths {
1755
1752
  * "per_account": 1,
1756
1753
  * "start_url": "https://www.ufcalendar.com/account/api?trial=1"
1757
1754
  * },
1758
- * "enterprise": {
1759
- * "contact": "api@ufcalendar.com"
1760
- * },
1761
1755
  * "mcp": {
1762
1756
  * "url": "https://api.ufcalendar.com/mcp",
1763
1757
  * "transport": "streamable-http",
@@ -3617,7 +3611,7 @@ interface paths {
3617
3611
  };
3618
3612
  /**
3619
3613
  * Search completed bouts (filtered)
3620
- * @description Completed bouts with a winner across the launch promotions, filtered — the one-call answer to "the last title fight to end by knockout" or "every submission win for this fighter". **At least one narrowing filter is required** (`title_only`, `method`, `division`, `fighter`, `winner`, `from`, `to`, `main_events_only`; `org`, `order`, `limit` and `cursor` do not count) — a bare call 400s `filter_required`, because the whole table is the Enterprise bulk snapshot, not a list endpoint. Newest first by default (`order=oldest` reverses it); inside one card the main event comes first, then card order. Up to 25 rows per page and at most 10 pages deep (`page_depth_exceeded` past that — narrow the filters). Each row is the bout (same shape as `/v1/fights/{id}`) plus its `event` (`id`, `slug`, `title`, `org`, `starts_at`); `meta.filters` echoes the filters applied. `fighter`/`winner` take a slug or id (404 when not on the roster).
3614
+ * @description Completed bouts with a winner across the launch promotions, filtered — the one-call answer to "the last title fight to end by knockout" or "every submission win for this fighter". **At least one narrowing filter is required** (`title_only`, `method`, `division`, `fighter`, `winner`, `from`, `to`, `main_events_only`; `org`, `order`, `limit` and `cursor` do not count) — a bare call 400s `filter_required`, because the whole table is not sold as a list or a bulk export on any plan. Newest first by default (`order=oldest` reverses it); inside one card the main event comes first, then card order. Up to 25 rows per page and at most 10 pages deep (`page_depth_exceeded` past that — narrow the filters). Each row is the bout (same shape as `/v1/fights/{id}`) plus its `event` (`id`, `slug`, `title`, `org`, `starts_at`); `meta.filters` echoes the filters applied. `fighter`/`winner` take a slug or id (404 when not on the roster).
3621
3615
  */
3622
3616
  get: {
3623
3617
  parameters: {
@@ -5671,7 +5665,7 @@ interface paths {
5671
5665
  };
5672
5666
  /**
5673
5667
  * Fighter profile
5674
- * @description Bio, records, stats, UFCalendar Power Index summary, and CC-licensed images with attribution metadata (displaying the credit is a license requirement). **Read `records` and `stats`** (added 2026-09-24): `records` is a map keyed by a clean name — `pro_mma` (the career MMA record), `amateur_mma`, `pro_kickboxing`, …, and the org slug for a record INSIDE one promotion (`ufc`, `one`, `bkfc`) — each `{ value, source, scope }`; `stats` is ONE per-minute panel (SLpM, striking accuracy/defense, SApM, takedown average/accuracy/defense, submission average), always the widest sample UFCalendar holds, with `basis: { bouts, orgs, source, scope }` stating exactly which bouts it averages over (e.g. 7 UFC bouts, or 18 across UFC + Oktagon); `null` when no real panel exists. `career_stats` is the raw per-source row list these are built from and stays unchanged for existing integrations.
5668
+ * @description Bio, records, stats, UFCalendar Power Index summary, and CC-licensed images with attribution metadata (displaying the credit is a license requirement). **Read `records` and `stats`** (added 2026-09-24): `records` is a map keyed by a clean name — `pro_mma` (the career MMA record), `amateur_mma`, `pro_kickboxing`, …, and the org slug for a record INSIDE one promotion (`ufc`, `one`, `bkfc`) — each `{ value, source, scope }`; `stats` is ONE per-minute panel (SLpM, striking accuracy/defense, SApM, takedown average/accuracy/defense, submission average), always the widest sample UFCalendar holds (the `pro-mma` panel: every promotion; `tracked` for a fighter with no MMA career, e.g. a Muay Thai athlete), with `basis: { bouts, orgs, source, scope }` stating exactly which bouts it averages over (e.g. 7 UFC bouts, or 18 across UFC + Oktagon); `null` when no real panel exists. `career_stats` is the raw per-source row list these are built from and stays unchanged for existing integrations.
5675
5669
  *
5676
5670
  * `next_fight` is the fighter's next booked bout (not completed or cancelled, on an event that has not been cancelled and started no more than ~6h ago; `result` is always null) and `last_fight` their most recent completed or no-contest bout — both in the same shape as a `source: "native"` row of `/history`, or `null`.
5677
5671
  *
@@ -5732,6 +5726,15 @@ interface paths {
5732
5726
  * "team": "Chute Boxe Diego Lima",
5733
5727
  * "birthplace": "Guarujá, Brazil",
5734
5728
  * "records": {
5729
+ * "pro_mma": {
5730
+ * "value": "37-11-0 (1 NC)",
5731
+ * "wins": 37,
5732
+ * "losses": 11,
5733
+ * "draws": 0,
5734
+ * "no_contests": 1,
5735
+ * "source": "public-records",
5736
+ * "scope": "pro-mma"
5737
+ * },
5735
5738
  * "ufc": {
5736
5739
  * "value": "25-11-0 (1 NC)",
5737
5740
  * "wins": 25,
@@ -5766,12 +5769,25 @@ interface paths {
5766
5769
  * "orgs": [
5767
5770
  * "ufc"
5768
5771
  * ],
5769
- * "source": "ufc-stats",
5770
- * "scope": "ufc-only"
5772
+ * "source": "ufcalendar",
5773
+ * "scope": "pro-mma"
5771
5774
  * }
5772
5775
  * },
5773
5776
  * "career_stats": [
5774
5777
  * {
5778
+ * "scope": "pro-mma",
5779
+ * "source": "public-records",
5780
+ * "record": "37-11-0 (1 NC)",
5781
+ * "slpm": "3.23",
5782
+ * "str_acc": "55%",
5783
+ * "sapm": "3.05",
5784
+ * "str_def": null,
5785
+ * "td_avg": "2.29",
5786
+ * "td_acc": "39%",
5787
+ * "td_def": "54%",
5788
+ * "sub_avg": null
5789
+ * },
5790
+ * {
5775
5791
  * "scope": "ufc-only",
5776
5792
  * "source": "ufc-stats",
5777
5793
  * "record": "25-11-0 (1 NC)",
@@ -6128,7 +6144,7 @@ interface paths {
6128
6144
  };
6129
6145
  /**
6130
6146
  * Career statistics
6131
- * @description Raw per-source career rows, plus the readable split in `meta.records` / `meta.stats` (the same objects the fighter profile carries — read those unless you need the per-source rows). `data`: per-scope career stats (`pro-mma`, `amateur-mma`, …): record, strikes landed/absorbed per minute, accuracy/defense, takedown and submission averages, and `updated_at` (this route only). Exactly ONE row per scope; `source` names the publisher it came from: `public-records` (the complete multi-promotion career record) is preferred, then the promotion's own site (`ufc-stats`, `bkfc-official`, `one-official`, …), then `ufcalendar`. A `public-records` record is a point-in-time snapshot advanced by every settled bout UFCalendar tracked after it, so it matches the record on ufcalendar.com. Org-scoped rows (`ufc-only`, `bkfc-only`, `one-only`) are the fighter's record INSIDE that promotion, not a career record: `ufc-only` pairs ufcstats' UFC-bouts-only striking/grappling averages with a record UFCalendar derives from the fighter's tracked UFC bouts (Contender Series excluded, `W-L-D` plus ` (n NC)`; null until a UFC bout is settled), while `bkfc-only` / `one-only` carry the promotion's own published record. ufcstats', OKTAGON's and ACA's header records are CAREER records and ship under `pro-mma` (the `public-records` row wins the scope when present, unless ufcstats counts more bouts). Scope `tracked` rows are computed by UFCalendar from per-fight totals when no published panel carries data (e.g. Contender Series debutants, PFL/OKTAGON rosters); their `record` is always null.
6147
+ * @description Raw per-source career rows, plus the readable split in `meta.records` / `meta.stats` (the same objects the fighter profile carries — read those unless you need the per-source rows). `data`: per-scope career stats (`pro-mma`, `amateur-mma`, …): record, strikes landed/absorbed per minute, accuracy/defense, takedown and submission averages, and `updated_at` (this route only). Exactly ONE row per scope; `source` names the publisher it came from: `public-records` (the complete multi-promotion career record) is preferred, then the promotion's own site (`ufc-stats`, `bkfc-official`, `one-official`, …), then `ufcalendar`. A `public-records` record is a point-in-time snapshot advanced by every settled bout UFCalendar tracked after it, so it matches the record on ufcalendar.com. A row's record and its stats cover the same bouts. `pro-mma` = the career record plus striking/grappling averages UFCalendar computes over EVERY settled bout it holds per-fight totals for, in any promotion (Contender Series included); its stats are null when no such bout exists. Org-scoped rows (`ufc-only`, `bkfc-only`, `one-only`) are the fighter's record INSIDE that promotion, not a career record: `ufc-only` carries a record AND averages UFCalendar derives from the fighter's tracked UFC bouts only (Contender Series excluded, `W-L-D` plus ` (n NC)`; both null until a UFC bout is settled — a Contender-Series-only fighter has no UFC stats), while `bkfc-only` / `one-only` carry the promotion's own published record. A fighter whose records show no MMA career at all (a ONE Muay Thai or kickboxing athlete) carries the every-promotion averages on a `tracked` row (null record) instead of `pro-mma`, because those bouts are not MMA. ufcstats', OKTAGON's and ACA's header records are CAREER records and ship under `pro-mma` (the `public-records` row wins the scope when present, unless ufcstats counts more bouts).
6132
6148
  */
6133
6149
  get: {
6134
6150
  parameters: {
@@ -9669,7 +9685,7 @@ interface paths {
9669
9685
  put?: never;
9670
9686
  /**
9671
9687
  * Register a webhook endpoint
9672
- * @description Pro+. Body: `{"url": "https://...", "events": ["event.announced", "fight.result", "card.changed", "event.completed", "odds.moved"]}`. Subscribe to `event.announced` and you do not need to poll `/v1/events` to discover new cards — it fires once, within a minute of a card first landing in our data, and carries the same event object the list endpoint returns. `odds.moved` fires when the UFCalendar consensus line on an upcoming bout moves at least 5 implied-probability points on corner a, or the favourite flips, measured against the last line we delivered for that bout (its opening line before the first delivery), so a slow drift arrives once, not per refresh: `data` is `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}`. Information only, not betting advice. The response contains the signing `secret` ONCE. Every delivery body is `{"id", "type", "data", "sent_at"}` (`WebhookDelivery` schema) — `id` is stable across retries, so deduplicate on it. Deliveries carry `X-UFCalendar-Signature: t=<unix>,v1=<hmac>` where the HMAC-SHA256 input is `"<t>.<rawBody>"`. **Verify the timestamp too**: reject anything where `|now - t|` exceeds 300 seconds, otherwise a captured delivery can be replayed at you forever with a valid HMAC. Delivery is at-least-once — expect a retry roughly every 60s until your endpoint returns 2xx. Endpoints auto-disable after 20 consecutive failures, and you may hold at most 3 active endpoints (409 `endpoint_limit`). Latency: results are dispatched within ~1 minute of the result being recorded. `event.announced` only fires for cards that have not started yet, so archive backfills never reach you as new-card noise. `card.changed` is filtered the same way: a change whose before and after read identically (a venue row re-minted for the same arena, a source dropping a sub-time it never knew) is never delivered, and when a source flip-flops a value we deliver the move and its undo once, not the twentieth repeat. Deliveries are free — they never count against your monthly request quota, only the calls you make to manage endpoints do.
9688
+ * @description Pro+. Body: `{"url": "https://...", "events": ["event.announced", "fight.result", "card.changed", "event.completed", "odds.moved"]}`. Subscribe to `event.announced` and you do not need to poll `/v1/events` to discover new cards — it fires once, within a minute of a card first landing in our data, and carries the same event object the list endpoint returns. `fight.result` fires once per bout within a minute of the result, as `revision` 1, and again as the next revision (`corrected: true`, with the `previous` result) whenever the winner, method, round, time or status is corrected in the 72 h after it — upsert on `fight_id` and keep the highest `revision`. `odds.moved` fires when the UFCalendar consensus line on an upcoming bout moves at least 5 implied-probability points on corner a, or the favourite flips, measured against the last line we delivered for that bout (its opening line before the first delivery), so a slow drift arrives once, not per refresh: `data` is `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}`. Information only, not betting advice. The response contains the signing `secret` ONCE. Every delivery body is `{"id", "type", "data", "sent_at"}` (`WebhookDelivery` schema) — `id` is stable across retries, so deduplicate on it. Deliveries carry `X-UFCalendar-Signature: t=<unix>,v1=<hmac>` where the HMAC-SHA256 input is `"<t>.<rawBody>"`. **Verify the timestamp too**: reject anything where `|now - t|` exceeds 300 seconds, otherwise a captured delivery can be replayed at you forever with a valid HMAC. Delivery is at-least-once — expect a retry roughly every 60s until your endpoint returns 2xx. Endpoints auto-disable after 20 consecutive failures, and you may hold at most 3 active endpoints (409 `endpoint_limit`). Latency: results are dispatched within ~1 minute of the result being recorded. `event.announced` only fires for cards that have not started yet, so archive backfills never reach you as new-card noise. `card.changed` is filtered the same way: a change whose before and after read identically (a venue row re-minted for the same arena, a source dropping a sub-time it never knew) is never delivered, and when a source flip-flops a value we deliver the move and its undo once, not the twentieth repeat. Deliveries are free — they never count against your monthly request quota, only the calls you make to manage endpoints do.
9673
9689
  */
9674
9690
  post: {
9675
9691
  parameters: {
@@ -9993,91 +10009,6 @@ interface paths {
9993
10009
  patch?: never;
9994
10010
  trace?: never;
9995
10011
  };
9996
- "/v1/bulk/{kind}": {
9997
- parameters: {
9998
- query?: never;
9999
- header?: never;
10000
- path?: never;
10001
- cookie?: never;
10002
- };
10003
- /**
10004
- * Bulk snapshot (Enterprise only)
10005
- * @description Enterprise only — the full dataset is licensed, not self-serve; contact api@ufcalendar.com. Downloads the full launch-scope dataset as gzipped JSON: `events.json.gz`, `fights.json.gz`, `fighters.json.gz` or `odds-closing.json.gz` (the closing-line archive: one row per priced, settled bout since 2012 with `fight_id`, `event_id`, `event_slug`, `org`, `starts_at`, `fighter_a_id`, `fighter_b_id`, `winner_fighter_id`, `opening_a` / `opening_b` / `opening_at`, `closing_a` / `closing_b` / `closing_at` as American moneylines, and `sources`; UFCalendar consensus only, no book identities, information only). Responds 302 to a presigned URL; snapshots regenerate at most every 6 hours. One request per download (the redirect is free).
10006
- */
10007
- get: {
10008
- parameters: {
10009
- query?: never;
10010
- header?: never;
10011
- path: {
10012
- kind: "events.json.gz" | "fights.json.gz" | "fighters.json.gz" | "odds-closing.json.gz";
10013
- };
10014
- cookie?: never;
10015
- };
10016
- requestBody?: never;
10017
- responses: {
10018
- /** @description Redirect to a time-limited download URL */
10019
- 302: {
10020
- headers: {
10021
- Location?: string;
10022
- [name: string]: unknown;
10023
- };
10024
- content?: never;
10025
- };
10026
- /** @description Missing/invalid API key (`unauthorized`). */
10027
- 401: {
10028
- headers: {
10029
- [name: string]: unknown;
10030
- };
10031
- content: {
10032
- "application/json": components["schemas"]["Error"];
10033
- };
10034
- };
10035
- /** @description Requires an Enterprise agreement (`tier_required`). */
10036
- 403: {
10037
- headers: {
10038
- [name: string]: unknown;
10039
- };
10040
- content: {
10041
- "application/json": components["schemas"]["Error"];
10042
- };
10043
- };
10044
- /** @description Not found (`not_found`; staged-org data 404s until the org is promoted). */
10045
- 404: {
10046
- headers: {
10047
- [name: string]: unknown;
10048
- };
10049
- content: {
10050
- "application/json": components["schemas"]["Error"];
10051
- };
10052
- };
10053
- /** @description Rate limited (`rate_limited`) or monthly quota reached (`quota_exceeded`). Honor `Retry-After`. */
10054
- 429: {
10055
- headers: {
10056
- [name: string]: unknown;
10057
- };
10058
- content: {
10059
- "application/json": components["schemas"]["Error"];
10060
- };
10061
- };
10062
- /** @description Something broke on our side (`internal_error`). It has been logged under the `request_id`. */
10063
- 500: {
10064
- headers: {
10065
- [name: string]: unknown;
10066
- };
10067
- content: {
10068
- "application/json": components["schemas"]["Error"];
10069
- };
10070
- };
10071
- };
10072
- };
10073
- put?: never;
10074
- post?: never;
10075
- delete?: never;
10076
- options?: never;
10077
- head?: never;
10078
- patch?: never;
10079
- trace?: never;
10080
- };
10081
10012
  "/v1/usage": {
10082
10013
  parameters: {
10083
10014
  query?: never;
@@ -10249,7 +10180,7 @@ interface components {
10249
10180
  * @description Plan tier.
10250
10181
  * @enum {string}
10251
10182
  */
10252
- Tier: "trial" | "hobby" | "pro" | "business" | "enterprise";
10183
+ Tier: "trial" | "hobby" | "pro" | "business";
10253
10184
  /**
10254
10185
  * @description Webhook event types.
10255
10186
  * @enum {string}
@@ -10800,8 +10731,9 @@ interface components {
10800
10731
  bouts: number;
10801
10732
  /** @description Org slugs those bouts span. */
10802
10733
  orgs: string[];
10803
- /** @description `ufcalendar` (computed by UFCalendar from per-fight totals) or `ufc-stats` (ufcstats.com's UFC-only panel). */
10734
+ /** @description `ufcalendar` for the every-promotion panel, else the `ufc-only` row's source. Both are computed by UFCalendar from per-fight totals. */
10804
10735
  source: string;
10736
+ /** @description `pro-mma` (every settled bout with per-fight totals, any promotion) or `ufc-only` (UFC bouts only, Contender Series excluded). */
10805
10737
  scope: string;
10806
10738
  };
10807
10739
  /** @description ONE per-minute panel: the widest sample UFCalendar holds for the fighter. */
@@ -10845,7 +10777,7 @@ interface components {
10845
10777
  };
10846
10778
  /** @description Raw per-source career row, exactly one per scope. */
10847
10779
  CareerStatRow: {
10848
- /** @description `pro-mma`, `amateur-mma`, `pro-kickboxing`, …, `ufc-only` / `bkfc-only` / `one-only`, or `tracked`. */
10780
+ /** @description `pro-mma`, `amateur-mma`, `pro-kickboxing`, …, or `ufc-only` / `bkfc-only` / `one-only`. */
10849
10781
  scope: string;
10850
10782
  /** @description Who published the record: `ufc-stats` (ufcstats.com), a promotion's own site (`ufc-official`, `bkfc-official`, `one-official`, `oktagon-official`, …), `ufcalendar` (derived by UFCalendar), or `public-records` (the complete multi-promotion career record compiled from public records). */
10851
10783
  source: string;
@@ -12174,9 +12106,8 @@ interface components {
12174
12106
  Plan: {
12175
12107
  key: components["schemas"]["Tier"];
12176
12108
  name: string;
12177
- /** @description Null for Enterprise (contract). */
12178
- price_monthly_usd: number | null;
12179
- price_yearly_usd: number | null;
12109
+ price_monthly_usd: number;
12110
+ price_yearly_usd: number;
12180
12111
  requests_per_month: number;
12181
12112
  rpm: number;
12182
12113
  key_limit: number;
@@ -12193,9 +12124,6 @@ interface components {
12193
12124
  per_account: number;
12194
12125
  start_url: string;
12195
12126
  };
12196
- enterprise: {
12197
- contact: string;
12198
- };
12199
12127
  mcp: {
12200
12128
  url: string;
12201
12129
  transport: string;
@@ -12239,7 +12167,7 @@ interface components {
12239
12167
  /** @description Delivery id (stable across retries — deduplicate on it). */
12240
12168
  id: string;
12241
12169
  type: components["schemas"]["WebhookKind"];
12242
- /** @description `event.announced` / `event.completed`: `{event}` (the list-shape event); `fight.result`: the bout with `event` and `result`; `card.changed`: `{event, change}`; `odds.moved`: `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}` (UFCalendar consensus line, information only, not betting advice). */
12170
+ /** @description `event.announced` / `event.completed`: `{event}` (the list-shape event); `fight.result`: the bout with `event`, `result`, `revision` and `corrected` — `revision` 1 is the first delivery; if the winner, method, round, time or status changes within 72 h of the result, the bout is re-sent as the next revision with `corrected: true` and the `previous` result it replaces (upsert on `fight_id`, keep the highest `revision`); `card.changed`: `{event, change}`; `odds.moved`: `{fight_id, event, fighter_a, fighter_b, odds: {consensus, opening, movement, updated_at}, previous, delta_points_a, direction, favourite_flipped, moved_at}` (UFCalendar consensus line, information only, not betting advice). */
12243
12171
  data: {
12244
12172
  [key: string]: unknown;
12245
12173
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.7.0";
2
+ var VERSION = "0.8.1";
3
3
 
4
4
  // src/client.ts
5
5
  var DEFAULT_BASE_URL = "https://api.ufcalendar.com/v1";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts","../src/client.ts"],"sourcesContent":["/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.7.0';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n let res: Response;\n try {\n res = await this.#fetch(this.#url(path, params), {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n const text = await res.text();\n let parsed: unknown = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans, quotas, the free 1-day trial rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /** Per-fight totals for both corners. */\n fightStats(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";AAEO,IAAM,UAAU;;;AC2EhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAkBpB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAc,SAAiB,YAA2B,MAAM;AAC1F,UAAM,GAAG,MAAM,IAAI,IAAI,KAAK,OAAO,GAAG,YAAY,gBAAgB,SAAS,MAAM,EAAE,EAAE;AACrF,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAgBA,SAA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CAAC,GAAG;AAAA,EACvF;AAAA,EAEA,MAAM,sBAAsB,YAA4C;AACtE,UAAM,KAAK,SAAkB,UAAU,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC,EAAE;AAAA,EACtG;AAAA,EAEA,MAAM,oBAAoB,YAAuD;AAC/E,YACE,MAAM,KAAK;AAAA,MACT;AAAA,MACA,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC;AAAA,IAC7D,GACA;AAAA,EACJ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts","../src/client.ts"],"sourcesContent":["/** Kept in lockstep with package.json and the User-Agent by\n * `apps/api/src/surfaces.test.ts`. Bump all three together. */\nexport const VERSION = '0.8.1';\n","/**\n * Thin, dependency-free client for https://api.ufcalendar.com/v1.\n *\n * Every method returns the parsed `data` value of the JSON envelope\n * (`{\"data\": ..., \"meta\": ...}`); list endpoints are async generators that\n * follow cursor pagination for you. Errors throw `FightAPIError` carrying\n * the API's `code`, `message` and `requestId` — quote the request id when\n * you write to api@ufcalendar.com.\n *\n * Mirrors sdk/python/ufcalendar/client.py one method per endpoint, in\n * camelCase. The two clients are kept in lockstep by\n * `apps/api/src/surfaces.test.ts`.\n *\n * Odds are the UFCalendar consensus line: one anonymised line per corner\n * across the sportsbooks we track (`sources` = how many books backed each\n * point; book identities are never exposed). Information only, not betting\n * advice. Fighter `images` are Wikimedia\n * Commons / Creative Commons files — the `license` and `artist` fields you\n * receive must be displayed as a credit.\n */\nimport { VERSION } from './version';\nimport type {\n Article,\n ArticleLocale,\n ArticleSummary,\n EventPickem,\n EventOdds,\n FightInclude,\n FightOdds,\n OddsHistoryPoint,\n Compare,\n Matchup,\n WhosNext,\n EventStorylines,\n YearStats,\n EventWatch,\n OrgDivision,\n LeaderboardRow,\n RecordBookSection,\n StatScope,\n RightsSeries,\n SplitDecisionRow,\n ChangeFeedEntry,\n ChangeKind,\n FightSearchMethod,\n FightSearchRow,\n BroadcastRight,\n CareerBout,\n CareerStats,\n Champion,\n EventInclude,\n EventListInclude,\n JudgeScorecardRow,\n PowerIndexMover,\n PowerIndexRow,\n PowerIndexView,\n Envelope,\n EventChange,\n EventDetail,\n EventSummary,\n Fight,\n Fighter,\n FighterInclude,\n FighterSummary,\n Judge,\n Meta,\n Org,\n Plans,\n PowerIndex,\n RankingsBoard,\n RateLimit,\n Scorecards,\n Usage,\n Venue,\n WebhookEndpoint,\n} from './types';\n\nexport const DEFAULT_BASE_URL = 'https://api.ufcalendar.com/v1';\nconst DEFAULT_TIMEOUT_MS = 30_000;\n\nexport interface FightAPIOptions {\n /** `ufcalendar_…` key from https://www.ufcalendar.com/account/api. Falls back\n * to `UFCALENDAR_API_KEY` / `UFCAL_API_KEY` in the environment. Only\n * `plans()` works without one. */\n apiKey?: string;\n /** Override for testing; defaults to the production `/v1`. */\n baseUrl?: string;\n /** Inject a fetch (a test double, an instrumented fetch, undici). */\n fetch?: typeof fetch;\n /** Per-request timeout. Default 30s. */\n timeoutMs?: number;\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n}\n\n/** An error response from the Fight API. */\nexport class FightAPIError extends Error {\n readonly status: number;\n readonly code: string;\n readonly requestId: string | null;\n\n constructor(status: number, code: string, message: string, requestId: string | null = null) {\n super(`${status} ${code}: ${message}${requestId ? ` (request_id=${requestId})` : ''}`);\n this.name = 'FightAPIError';\n this.status = status;\n this.code = code;\n this.requestId = requestId;\n }\n}\n\nexport type QueryValue = string | number | boolean | null | undefined;\nexport type Query = Record<string, QueryValue>;\n\ninterface PageOptions {\n /** Stop after this many rows (across pages). */\n limit?: number;\n}\n\n/**\n * A browser forbids setting User-Agent on fetch, so we only set ours\n * off-browser. The test is `document`, NOT `navigator`: Node 21+ ships a\n * global `navigator`, so a navigator check would silently drop the header\n * on every modern Node runtime — which is the one place it works.\n */\nfunction canSetUserAgent(): boolean {\n return typeof document === 'undefined' && typeof window === 'undefined';\n}\n\nfunction envKey(): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;\n return env?.UFCALENDAR_API_KEY || env?.UFCAL_API_KEY;\n}\n\nexport class FightAPI {\n readonly baseUrl: string;\n readonly apiKey: string | undefined;\n\n /** `meta` of the most recent response (pagination cursor, generated_at …). */\n lastMeta: Meta | null = null;\n /** `X-RateLimit-*` of the most recent response. */\n lastRateLimit: RateLimit = { limit: null, remaining: null, reset: null };\n\n readonly #fetch: typeof fetch;\n readonly #timeoutMs: number;\n readonly #headers: Record<string, string>;\n\n constructor(apiKeyOrOptions?: string | FightAPIOptions, options: FightAPIOptions = {}) {\n const opts: FightAPIOptions =\n typeof apiKeyOrOptions === 'string'\n ? { ...options, apiKey: apiKeyOrOptions }\n : { ...options, ...(apiKeyOrOptions ?? {}) };\n this.apiKey = opts.apiKey ?? envKey();\n this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '');\n this.#fetch = opts.fetch ?? globalThis.fetch;\n this.#timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.#headers = opts.headers ?? {};\n if (!this.#fetch) {\n throw new Error('No global fetch available. Use Node 18+ or pass { fetch }.');\n }\n }\n\n /* ---------------------------------------------------------------- core */\n\n #url(path: string, params?: Query): string {\n const url = new URL(`${this.baseUrl}/${path.replace(/^\\/+/, '')}`);\n for (const [k, v] of Object.entries(params ?? {})) {\n if (v === undefined || v === null) continue;\n url.searchParams.set(k, String(v));\n }\n return url.toString();\n }\n\n async #request<T>(\n method: string,\n path: string,\n { params, body, open = false }: { params?: Query; body?: unknown; open?: boolean } = {},\n ): Promise<Envelope<T>> {\n if (!this.apiKey && !open) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n const headers: Record<string, string> = { Accept: 'application/json', ...this.#headers };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\n if (canSetUserAgent()) headers['User-Agent'] = `ufcalendar-typescript/${VERSION}`;\n if (body !== undefined) headers['Content-Type'] = 'application/json';\n\n let res: Response;\n try {\n res = await this.#fetch(this.#url(path, params), {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n signal: AbortSignal.timeout(this.#timeoutMs),\n });\n } catch (e) {\n const err = e as { name?: string; message?: string };\n if (err?.name === 'TimeoutError') {\n throw new FightAPIError(0, 'timeout', `Request to ${path} timed out after ${this.#timeoutMs}ms`);\n }\n throw new FightAPIError(0, 'network_error', err?.message ?? String(e));\n }\n\n this.lastRateLimit = {\n limit: res.headers.get('X-RateLimit-Limit'),\n remaining: res.headers.get('X-RateLimit-Remaining'),\n reset: res.headers.get('X-RateLimit-Reset'),\n };\n\n if (res.status === 204) {\n this.lastMeta = null;\n return { data: undefined as T };\n }\n\n const text = await res.text();\n let parsed: unknown = undefined;\n try {\n parsed = text ? JSON.parse(text) : undefined;\n } catch {\n parsed = undefined;\n }\n\n if (!res.ok) {\n const err = (parsed as { error?: { code?: string; message?: string; request_id?: string } } | undefined)?.error;\n if (err) {\n throw new FightAPIError(\n res.status,\n String(err.code ?? 'error'),\n String(err.message ?? text.slice(0, 200)),\n err.request_id ?? res.headers.get('x-request-id'),\n );\n }\n throw new FightAPIError(res.status, 'http_error', text.slice(0, 200), res.headers.get('x-request-id'));\n }\n\n const env = (parsed ?? {}) as Envelope<T>;\n this.lastMeta = env.meta ?? null;\n return env;\n }\n\n /** Raw GET returning the `data` value. Escape hatch for new endpoints. */\n async get<T = unknown>(path: string, params?: Query): Promise<T> {\n return (await this.#request<T>('GET', path, { params })).data;\n }\n\n /** Raw GET returning the whole `{data, meta}` envelope. */\n async getWithMeta<T = unknown>(path: string, params?: Query): Promise<Envelope<T>> {\n return this.#request<T>('GET', path, { params });\n }\n\n async *#paginate<T>(path: string, params: Query, opts: PageOptions = {}): AsyncGenerator<T, void, void> {\n // Never fetch a bigger page than the caller wants rows: `limit: 3` used\n // to pull 100 rows and throw 97 away, burning the caller's quota on a\n // request they did not ask for (and, on a trial key, a noticeable slice\n // of the 100 they get).\n const pageSize = Math.min(100, opts.limit ?? 100);\n const query: Query = { limit: pageSize, ...params };\n let seen = 0;\n for (;;) {\n const env = await this.#request<T[]>('GET', path, { params: query });\n for (const row of env.data ?? []) {\n yield row;\n seen += 1;\n if (opts.limit !== undefined && seen >= opts.limit) return;\n }\n const cursor = env.meta?.pagination?.next_cursor;\n if (!cursor) return;\n query.cursor = cursor;\n }\n }\n\n /* --------------------------------------------------------------- plans */\n\n /**\n * Plans, quotas, the free 1-day trial rule, the MCP endpoint and the doc\n * links. The only endpoint that answers without a credential.\n */\n async plans(): Promise<Plans> {\n return (await this.#request<Plans>('GET', 'plans', { open: true })).data;\n }\n\n /* ---------------------------------------------------------------- orgs */\n\n /** Launch orgs with capability flags (stats / rounds / rankings / broadcasts / predictions / scorecards / odds). */\n orgs(): Promise<Org[]> {\n return this.get<Org[]>('orgs');\n }\n\n org(slug: string): Promise<Org> {\n return this.get<Org>(`orgs/${encodeURIComponent(slug)}`);\n }\n\n /**\n * One weight class in one promotion: its rankings board (null where the\n * promotion publishes none), upcoming bouts at that weight, the latest\n * results and the roster by recency. `division` is a slug, e.g.\n * `lightweight` or `womens-strawweight`.\n */\n orgDivision(org: string, division: string): Promise<OrgDivision> {\n return this.get<OrgDivision>(`orgs/${encodeURIComponent(org)}/divisions/${encodeURIComponent(division)}`);\n }\n\n /* -------------------------------------------------------------- events */\n\n /**\n * Schedule + results. Bare call = the upcoming calendar, soonest first.\n * `status: 'completed'` (or `order: 'desc'`) browses the archive\n * newest-first; `status: 'upcoming'` = every card not yet over (announced,\n * scheduled or live). `from` / `to` are `YYYY-MM-DD`.\n */\n events(\n opts: {\n org?: string;\n status?: string;\n from?: string;\n to?: string;\n order?: 'asc' | 'desc';\n /** Only cards with (true) / without (false) a title bout. */\n isTitleCard?: boolean;\n /** Only PPV (true) / non-PPV (false) cards. */\n isPpv?: boolean;\n /** `headline` adds each card's main event. */\n include?: EventListInclude[];\n limit?: number;\n } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, isTitleCard, isPpv, include, ...params } = opts;\n return this.#paginate<EventSummary>('events', {\n ...params,\n is_title_card: isTitleCard,\n is_ppv: isPpv,\n include: include?.length ? include.join(',') : undefined,\n } as Query, { limit });\n }\n\n /**\n * One event with its full fight card, venue and broadcasts.\n * `include: ['eta']` adds an estimated start time to every bout;\n * `include: ['odds']` adds each bout's current consensus line (the closing line once settled) (null when\n * unpriced). Pass both as `['eta', 'odds']`.\n */\n event(idOrSlug: string | number, opts: { include?: EventInclude[] } = {}): Promise<EventDetail> {\n return this.get<EventDetail>(\n `events/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * Who airs one event, per country: the promotion's rights deals for the\n * event's series merged with the event's own listings. `country` (ISO-2)\n * narrows to that market plus worldwide.\n */\n eventWatch(idOrSlug: string | number, opts: { country?: string } = {}): Promise<EventWatch> {\n return this.get<EventWatch>(`events/${encodeURIComponent(String(idOrSlug))}/watch`, opts as Query);\n }\n\n /**\n * The talking points of one card as of its start: title fights and\n * eliminators, the closest bout (UFCalendar model, else Power Index — not\n * betting advice), rematches and trilogy deciders, streaks, debuts and\n * returns, ranked fighters, nations, tallest / longest reach, the fastest\n * career finish.\n */\n eventStorylines(idOrSlug: string | number): Promise<EventStorylines> {\n return this.get<EventStorylines>(`events/${encodeURIComponent(String(idOrSlug))}/storylines`);\n }\n\n /**\n * How the UFCalendar community is picking each bout on one card: picks per\n * corner, the total and `pct_a`, in card order. Crowd sentiment from our\n * own pick'em game, not a market and not a forecast.\n */\n eventPickem(idOrSlug: string | number): Promise<EventPickem> {\n return this.get<EventPickem>(`events/${encodeURIComponent(String(idOrSlug))}/pickem`);\n }\n\n /**\n * The UFCalendar consensus odds for every non-cancelled bout on one card, in\n * card order: `consensus`, `opening`, `closing` (settled bouts), `movement`\n * and `points`. Unpriced bouts stay on the list with nulls and `points: 0`;\n * `lastMeta.priced` / `lastMeta.unpriced` count both. Information only, not\n * betting advice.\n */\n eventOdds(idOrSlug: string | number): Promise<EventOdds> {\n return this.get<EventOdds>(`events/${encodeURIComponent(String(idOrSlug))}/odds`);\n }\n\n /** Card-change diff log (fight added/removed, opponent swapped, date moved, profile merged). */\n eventChanges(idOrSlug: string | number): Promise<EventChange[]> {\n return this.get<EventChange[]>(`events/${encodeURIComponent(String(idOrSlug))}/changes`);\n }\n\n /**\n * The card-change feed across every event, newest first (default: the last\n * 90 days) — the `card.changed` webhook's audit trail, for callers that\n * poll. `since` is `YYYY-MM-DD` or an ISO-8601 datetime.\n */\n changes(\n opts: { org?: string; since?: string; kind?: ChangeKind; limit?: number } = {},\n ): AsyncGenerator<ChangeFeedEntry, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ChangeFeedEntry>('changes', params as Query, { limit });\n }\n\n /* -------------------------------------------------------------- fights */\n\n /** One bout with its result. `include: ['odds']` adds the current consensus line (the closing line once the bout is settled). */\n fight(fightId: number | string, opts: { include?: FightInclude[] } = {}): Promise<Fight> {\n return this.get<Fight>(\n `fights/${encodeURIComponent(String(fightId))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /**\n * The UFCalendar consensus line for one bout: `consensus` (latest point; the closing line once settled),\n * `opening`, `closing` (the last point at or before the event start,\n * settled bouts only), `movement` (opening → consensus in implied-probability\n * points on corner a) and `sources` on every point (how many sportsbooks\n * backed it; book identities are never exposed). An unpriced bout resolves\n * with null blocks and `points: 0`. Information only, not betting advice.\n */\n fightOdds(fightId: number | string): Promise<FightOdds> {\n return this.get<FightOdds>(`fights/${encodeURIComponent(String(fightId))}/odds`);\n }\n\n /**\n * Every consensus point for one bout, oldest first (Pro plans and up; a\n * lower plan throws `FightAPIError` 403 `tier_required`). A point is stored\n * only when the consensus moves. `from` / `to` are inclusive `YYYY-MM-DD`.\n */\n fightOddsHistory(\n fightId: number | string,\n opts: { from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<OddsHistoryPoint, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<OddsHistoryPoint>(\n `fights/${encodeURIComponent(String(fightId))}/odds/history`,\n params as Query,\n { limit },\n );\n }\n\n /** Per-fight totals for both corners. */\n fightStats(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/stats`);\n }\n\n /** Round-by-round stat lines for both corners. */\n fightRounds(fightId: number | string): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(`fights/${encodeURIComponent(String(fightId))}/rounds`);\n }\n\n /**\n * The judges' scorecards for a bout — the official commission record:\n * decision type, point deductions, and one card per judge with every\n * round, the totals and `winner_fighter_id`. Scores are oriented to\n * `fighter_a_id` / `fighter_b_id`, both repeated on the payload.\n *\n * Check `scores_known` on a card before charting totals: when it is false\n * the commission published only the outcome. Throws 404 for a bout that\n * did not go to the judges.\n */\n fightScorecards(fightId: number | string): Promise<Scorecards> {\n return this.get<Scorecards>(`fights/${encodeURIComponent(String(fightId))}/scorecards`);\n }\n\n /**\n * Completed bouts, filtered — newest first unless `order: 'oldest'`. At\n * least one narrowing filter is required (`titleOnly`, `method`,\n * `division`, `fighter`, `winner`, `from`, `to`, `mainEventsOnly`); the\n * server serves 25 rows a page and at most 10 pages.\n */\n findFights(\n opts: {\n org?: string;\n titleOnly?: boolean;\n method?: FightSearchMethod;\n /** Division slug (`lightweight`) or a name fragment. */\n division?: string;\n /** Fighter slug or id — bouts they were in. */\n fighter?: string | number;\n /** Fighter slug or id — bouts they won. */\n winner?: string | number;\n from?: string;\n to?: string;\n mainEventsOnly?: boolean;\n order?: 'newest' | 'oldest';\n limit?: number;\n } = {},\n ): AsyncGenerator<FightSearchRow, void, void> {\n const { limit, titleOnly, mainEventsOnly, fighter, winner, ...rest } = opts;\n return this.#paginate<FightSearchRow>('fights/search', {\n ...rest,\n title_only: titleOnly,\n main_events_only: mainEventsOnly,\n fighter: fighter === undefined ? undefined : String(fighter),\n winner: winner === undefined ? undefined : String(winner),\n } as Query, { limit });\n }\n\n /* -------------------------------------------------------------- judges */\n\n /**\n * Every official who has scored a launch-org bout, busiest first. Rates\n * mean little below ~10 fights; pass `minFights: 10`.\n */\n judges(\n opts: { q?: string; org?: string; minFights?: number; limit?: number } = {},\n ): AsyncGenerator<Judge, void, void> {\n const { limit, minFights, ...rest } = opts;\n return this.#paginate<Judge>('judges', { ...rest, min_fights: minFights } as Query, { limit });\n }\n\n judge(judgeId: number | string): Promise<Judge> {\n return this.get<Judge>(`judges/${encodeURIComponent(String(judgeId))}`);\n }\n\n /**\n * Split and majority decisions, newest first, with every judge's card and\n * the dissenting judges named. Commission records only.\n */\n splitDecisions(\n opts: { org?: string; from?: string; to?: string; limit?: number } = {},\n ): AsyncGenerator<SplitDecisionRow, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<SplitDecisionRow>('scorecards/splits', params as Query, { limit });\n }\n\n /**\n * Every card this judge has turned in, newest first, with `lone_dissent`,\n * `split` and the `colleagues`' totals on each row.\n */\n judgeScorecards(\n judgeId: number | string,\n opts: { limit?: number } = {},\n ): AsyncGenerator<JudgeScorecardRow, void, void> {\n return this.#paginate<JudgeScorecardRow>(\n `judges/${encodeURIComponent(String(judgeId))}/scorecards`,\n {},\n opts,\n );\n }\n\n /* ------------------------------------------------------------ fighters */\n\n fighters(\n opts: { q?: string; org?: string; country?: string; limit?: number } = {},\n ): AsyncGenerator<FighterSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<FighterSummary>('fighters', params as Query, { limit });\n }\n\n /**\n * Bio, records, career stats, Power Index, CC-licensed images, `next_fight`\n * and `last_fight`. `include: ['bonuses']` adds the UFC bonus ledger;\n * `include: ['credentials']` adds grappling and wrestling pedigree, gyms and\n * coaches (every row with `sources` and a `confidence` grade).\n */\n fighter(idOrSlug: string | number, opts: { include?: FighterInclude[] } = {}): Promise<Fighter> {\n return this.get<Fighter>(\n `fighters/${encodeURIComponent(String(idOrSlug))}`,\n opts.include?.length ? { include: opts.include.join(',') } : undefined,\n );\n }\n\n /** Complete multi-promotion career timeline. */\n fighterHistory(idOrSlug: string | number): Promise<CareerBout[]> {\n return this.get<CareerBout[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/history`);\n }\n\n /** Raw career stat rows, one source-stamped row per scope (`pro-mma`, `ufc-only` …).\n * For the readable split use `fighter().records` / `fighter().stats`. */\n fighterStats(idOrSlug: string | number): Promise<CareerStats[]> {\n return this.get<CareerStats[]>(`fighters/${encodeURIComponent(String(idOrSlug))}/stats`);\n }\n\n /** Every ranking row the fighter ever held, newest first, across every board\n * (`board` is `official` / `meta`; `is_champion` when rank 0). The endpoint is\n * cursor-paginated since 2026-09-24 — this walks every page so the array is\n * complete (a long career is 900+ rows). */\n async fighterRankings(idOrSlug: string | number): Promise<Record<string, unknown>[]> {\n const out: Record<string, unknown>[] = [];\n for await (const row of this.#paginate<Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/rankings`, { limit: 500 } as Query)) out.push(row);\n return out;\n }\n\n fighterPowerIndex(idOrSlug: string | number): Promise<PowerIndex & Record<string, unknown>> {\n return this.get<PowerIndex & Record<string, unknown>>(\n `fighters/${encodeURIComponent(String(idOrSlug))}/power-index`,\n );\n }\n\n /**\n * Two fighters side by side (slugs or ids): bios with age, career stats,\n * strike mix, win streaks, previous meetings, common opponents, the booked\n * bout between them, the UFCalendar model prediction for it (UFC; not\n * betting advice) and Power Index ratings.\n */\n compare(a: string | number, b: string | number): Promise<Compare> {\n return this.get<Compare>('compare', { a: String(a), b: String(b) });\n }\n\n /* ------------------------------------------------------------ rankings */\n\n /**\n * Official board, point-in-time. `date: 'YYYY-MM-DD'` returns the board\n * that was valid on that day (UFC history back to 2013; rank 0 = champion).\n */\n rankings(org = 'ufc', opts: { date?: string; board?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(`rankings/${encodeURIComponent(org)}`, opts as Query);\n }\n\n divisionRankings(org: string, division: string, opts: { date?: string } = {}): Promise<RankingsBoard> {\n return this.get<RankingsBoard>(\n `rankings/${encodeURIComponent(org)}/${encodeURIComponent(division)}`,\n opts as Query,\n );\n }\n\n /** Current champions across every launch org, or one `org` / `division`. */\n champions(opts: { org?: string; division?: string } = {}): Promise<Champion[]> {\n return this.get<Champion[]>('champions', opts);\n }\n\n /**\n * UFCalendar Power Index board. `view: 'movers'` = biggest risers over\n * `days` (default 365), `view: 'peaks'` = all-time peak ratings;\n * `division` narrows any view.\n */\n powerIndex(\n org = 'ufc',\n opts: { view?: PowerIndexView; division?: string; days?: number; limit?: number } = {},\n ): Promise<(PowerIndexRow | PowerIndexMover)[]> {\n return this.get<(PowerIndexRow | PowerIndexMover)[]>(`power-index/${encodeURIComponent(org)}`, {\n view: opts.view,\n division: opts.division,\n days: opts.days,\n limit: opts.limit,\n });\n }\n\n /* ---------------------------------------------------------- matchmaker */\n\n /**\n * UFCalendar's matchmaker: the fights worth making in one MMA promotion,\n * scored 0–100, across the roster or for one `division` (`lastMeta.divisions`\n * lists the valid ones). Not a list of bookings; computed without the\n * site's Fight DNA factor.\n */\n matchmaker(org = 'ufc', opts: { division?: string; limit?: number } = {}): Promise<Matchup[]> {\n return this.get<Matchup[]>(`matchmaker/${encodeURIComponent(org)}`, {\n division: opts.division,\n limit: opts.limit,\n });\n }\n\n /**\n * Who one fighter (slug or id) should fight next: the best-scored\n * opponents with the Power Index win probability for each, plus the bout\n * already booked (`booked_next`).\n */\n whosNext(fighter: string | number, opts: { limit?: number } = {}): Promise<WhosNext> {\n return this.get<WhosNext>(`matchmaker/next/${encodeURIComponent(String(fighter))}`, { limit: opts.limit });\n }\n\n /* --------------------------------------------------------------- stats */\n\n /**\n * One Record Book leaderboard for one promotion (`metric` e.g. `wins`,\n * `fastest_knockout`, `finish_rate`). Narrow with `division` (slug),\n * `country` (ISO-2) or `population: 'active'` — not `country` and\n * `active` together. `lastMeta.metric` names the unit and what\n * `value_secondary` means.\n */\n leaderboard(\n org: string,\n metric: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; limit?: number } = {},\n ): Promise<LeaderboardRow[]> {\n return this.get<LeaderboardRow[]>('stats/leaders', { org, metric, ...opts } as Query);\n }\n\n /**\n * Every leaderboard's top rows (`top`, default 10, max 25) for one\n * promotion, grouped by category.\n */\n recordBook(\n org: string,\n opts: { division?: string; country?: string; population?: 'all' | 'active'; scope?: StatScope; top?: number } = {},\n ): Promise<RecordBookSection[]> {\n return this.get<RecordBookSection[]>('stats/record-book', { org, ...opts } as Query);\n }\n\n /**\n * One calendar year in numbers for one promotion, or every covered\n * promotion when `org` is omitted: events, title fights, finish methods,\n * divisions, fastest finishes, upsets, Power Index climbers, busiest\n * fighters, host countries and the most-used judges.\n */\n yearStats(year: number, opts: { org?: string } = {}): Promise<YearStats> {\n return this.get<YearStats>(`stats/years/${encodeURIComponent(String(year))}`, opts as Query);\n }\n\n /* ---------------------------------------------------------------- misc */\n\n /** Model win probabilities for upcoming UFC bouts; `event` narrows to one card. */\n predictionsUpcoming(opts: { event?: string | number } = {}): Promise<Record<string, unknown>[]> {\n return this.get<Record<string, unknown>[]>(\n 'predictions/upcoming',\n opts.event !== undefined ? { event: String(opts.event) } : undefined,\n );\n }\n\n /**\n * Who airs the promotion, per ISO-2 country — the org-wide deals, or a UFC\n * sub-series grid with `series: 'dwcs' | 'rtufc'`.\n */\n broadcastRights(org = 'ufc', opts: { country?: string; series?: RightsSeries } = {}): Promise<BroadcastRight[]> {\n return this.get<BroadcastRight[]>(`broadcast-rights/${encodeURIComponent(org)}`, opts as Query);\n }\n\n /**\n * Venues that hosted a covered promotion, alphabetical. `q` (2+ chars)\n * matches name or city; `country` is an ISO-2 code or an English name.\n */\n venues(opts: { q?: string; country?: string; limit?: number } = {}): AsyncGenerator<Venue, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<Venue>('venues', params as Query, { limit });\n }\n\n venue(venueId: number | string): Promise<Venue> {\n return this.get<Venue>(`venues/${encodeURIComponent(String(venueId))}`);\n }\n\n /** Every covered event at one venue, newest first (`order: 'asc'` reverses). */\n venueEvents(\n venueId: number | string,\n opts: { status?: string; from?: string; to?: string; order?: 'asc' | 'desc'; limit?: number } = {},\n ): AsyncGenerator<EventSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<EventSummary>(`venues/${encodeURIComponent(String(venueId))}/events`, params as Query, { limit });\n }\n\n /** Typeahead across fighters and events. */\n search(q: string): Promise<Record<string, unknown>> {\n return this.get<Record<string, unknown>>('search', { q });\n }\n\n /**\n * UFCalendar's own editorial archive, newest first. `q` (2+ chars) matches\n * title, summary or a tag; `tag` is exact; `locale` is one of the 13 site\n * languages (English fallback).\n */\n articles(\n opts: { q?: string; tag?: string; locale?: ArticleLocale; limit?: number } = {},\n ): AsyncGenerator<ArticleSummary, void, void> {\n const { limit, ...params } = opts;\n return this.#paginate<ArticleSummary>('articles', params as Query, { limit });\n }\n\n /**\n * One article: full Markdown `body_md` (client widgets removed), author,\n * tags, `published_at`; `served_locale` names the language\n * delivered.\n */\n article(slug: string, opts: { locale?: ArticleLocale } = {}): Promise<Article> {\n return this.get<Article>(`articles/${encodeURIComponent(slug)}`, opts as Query);\n }\n\n /** Your key's month-to-date quota usage. */\n usage(): Promise<Usage> {\n return this.get<Usage>('usage');\n }\n\n /**\n * Subscribable ICS feed URL for calendar apps (authenticates via `?key=`).\n *\n * Throws without a key rather than returning `?key=`: that empty URL is\n * pasted into a calendar app, fails there hours later, and the failure\n * surfaces nowhere near this call.\n */\n calendarIcsUrl(org = 'ufc'): string {\n if (!this.apiKey) {\n throw new FightAPIError(\n 401,\n 'no_api_key',\n 'No API key. Pass new FightAPI(\"ufcalendar_...\") or set UFCALENDAR_API_KEY. ' +\n 'Keys (and the free 1-day trial) live at https://www.ufcalendar.com/account/api',\n );\n }\n return `${this.baseUrl}/calendar/${encodeURIComponent(org)}.ics?key=${encodeURIComponent(this.apiKey)}`;\n }\n\n /* ------------------------------------------------------------ webhooks */\n\n webhookEndpoints(): Promise<WebhookEndpoint[]> {\n return this.get<WebhookEndpoint[]>('webhook-endpoints');\n }\n\n /**\n * Register a signed webhook (Pro and up). `events` ⊆ `event.announced`,\n * `fight.result`, `card.changed`, `event.completed`, `odds.moved` (the\n * consensus line on an upcoming bout moved 5+ implied-probability points or\n * the favourite flipped). The signing secret is returned ONCE, in this\n * response.\n */\n async createWebhookEndpoint(url: string, events?: string[]): Promise<WebhookEndpoint> {\n const body: Record<string, unknown> = { url };\n if (events?.length) body.events = events;\n return (await this.#request<WebhookEndpoint>('POST', 'webhook-endpoints', { body })).data;\n }\n\n async deleteWebhookEndpoint(endpointId: number | string): Promise<void> {\n await this.#request<unknown>('DELETE', `webhook-endpoints/${encodeURIComponent(String(endpointId))}`);\n }\n\n async rotateWebhookSecret(endpointId: number | string): Promise<WebhookEndpoint> {\n return (\n await this.#request<WebhookEndpoint>(\n 'POST',\n `webhook-endpoints/${encodeURIComponent(String(endpointId))}/rotate-secret`,\n )\n ).data;\n }\n}\n"],"mappings":";AAEO,IAAM,UAAU;;;AC2EhB,IAAM,mBAAmB;AAChC,IAAM,qBAAqB;AAkBpB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAc,SAAiB,YAA2B,MAAM;AAC1F,UAAM,GAAG,MAAM,IAAI,IAAI,KAAK,OAAO,GAAG,YAAY,gBAAgB,SAAS,MAAM,EAAE,EAAE;AACrF,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAgBA,SAAS,kBAA2B;AAClC,SAAO,OAAO,aAAa,eAAe,OAAO,WAAW;AAC9D;AAEA,SAAS,SAA6B;AACpC,QAAM,MAAO,WAA0E,SAAS;AAChG,SAAO,KAAK,sBAAsB,KAAK;AACzC;AAEO,IAAM,WAAN,MAAe;AAAA,EACX;AA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E,YACE,MAAM,KAAK;AAAA,MACT;AAAA,MACA,qBAAqB,mBAAmB,OAAO,UAAU,CAAC,CAAC;AAAA,IAC7D,GACA;AAAA,EACJ;AACF;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ufcalendar/sdk",
3
- "version": "0.7.0",
4
- "description": "TypeScript client for the UFCalendar Fight API: UFC, PFL, OKTAGON, BKFC and RIZIN events, fight cards, results, per-round stats, fighter careers, judges' scorecards and UFC rankings history since 2013.",
3
+ "version": "0.8.1",
4
+ "description": "MMA Fight Data API client for TypeScript — UFC, PFL, OKTAGON, BKFC, RIZIN events, fight stats, results, rankings history, judges' scorecards and consensus odds.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "UFCalendar <api@ufcalendar.com>",
@@ -12,16 +12,23 @@
12
12
  },
13
13
  "bugs": "https://github.com/UFCalendar/ufcalendar-typescript/issues",
14
14
  "keywords": [
15
- "ufc",
16
15
  "mma",
17
- "api",
18
- "mma-fight-data-api",
16
+ "ufc",
17
+ "ufc-stats",
19
18
  "mma-api",
20
- "sports-data",
19
+ "ufc-api",
21
20
  "fight-data",
22
- "rankings",
23
- "bkfc",
21
+ "sports-data",
22
+ "mma-fight-data-api",
23
+ "mma-stats",
24
+ "ufc-rankings",
25
+ "ufc-scorecards",
24
26
  "pfl",
27
+ "oktagon",
28
+ "bkfc",
29
+ "rizin",
30
+ "rankings",
31
+ "api",
25
32
  "mcp",
26
33
  "mcp-server",
27
34
  "mma-mcp",