fansunited-data-layer 0.0.14 → 0.2.0

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.
Files changed (127) hide show
  1. package/README.md +233 -12
  2. package/package.json +8 -2
  3. package/dist/api/sportal365-sports/constants.d.ts +0 -12
  4. package/dist/api/sportal365-sports/constants.d.ts.map +0 -1
  5. package/dist/api/sportal365-sports/football/competitions/competition.types.d.ts +0 -148
  6. package/dist/api/sportal365-sports/football/competitions/competition.types.d.ts.map +0 -1
  7. package/dist/api/sportal365-sports/football/competitions/index.d.ts +0 -51
  8. package/dist/api/sportal365-sports/football/competitions/index.d.ts.map +0 -1
  9. package/dist/api/sportal365-sports/football/competitions/utils.d.ts +0 -14
  10. package/dist/api/sportal365-sports/football/competitions/utils.d.ts.map +0 -1
  11. package/dist/api/sportal365-sports/football/http.d.ts +0 -8
  12. package/dist/api/sportal365-sports/football/http.d.ts.map +0 -1
  13. package/dist/api/sportal365-sports/football/index.d.ts +0 -15
  14. package/dist/api/sportal365-sports/football/index.d.ts.map +0 -1
  15. package/dist/api/sportal365-sports/football/matches/index.d.ts +0 -143
  16. package/dist/api/sportal365-sports/football/matches/index.d.ts.map +0 -1
  17. package/dist/api/sportal365-sports/football/matches/transformers/commentary.d.ts +0 -12
  18. package/dist/api/sportal365-sports/football/matches/transformers/commentary.d.ts.map +0 -1
  19. package/dist/api/sportal365-sports/football/matches/transformers/index.d.ts +0 -10
  20. package/dist/api/sportal365-sports/football/matches/transformers/index.d.ts.map +0 -1
  21. package/dist/api/sportal365-sports/football/matches/transformers/lineup.d.ts +0 -11
  22. package/dist/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +0 -1
  23. package/dist/api/sportal365-sports/football/matches/transformers/match-event.d.ts +0 -12
  24. package/dist/api/sportal365-sports/football/matches/transformers/match-event.d.ts.map +0 -1
  25. package/dist/api/sportal365-sports/football/matches/transformers/match.d.ts +0 -11
  26. package/dist/api/sportal365-sports/football/matches/transformers/match.d.ts.map +0 -1
  27. package/dist/api/sportal365-sports/football/matches/transformers/odds.d.ts +0 -11
  28. package/dist/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +0 -1
  29. package/dist/api/sportal365-sports/football/matches/transformers/statistics.d.ts +0 -11
  30. package/dist/api/sportal365-sports/football/matches/transformers/statistics.d.ts.map +0 -1
  31. package/dist/api/sportal365-sports/football/matches/types/commentary.types.d.ts +0 -27
  32. package/dist/api/sportal365-sports/football/matches/types/commentary.types.d.ts.map +0 -1
  33. package/dist/api/sportal365-sports/football/matches/types/event.types.d.ts +0 -19
  34. package/dist/api/sportal365-sports/football/matches/types/event.types.d.ts.map +0 -1
  35. package/dist/api/sportal365-sports/football/matches/types/index.d.ts +0 -16
  36. package/dist/api/sportal365-sports/football/matches/types/index.d.ts.map +0 -1
  37. package/dist/api/sportal365-sports/football/matches/types/lineup.types.d.ts +0 -78
  38. package/dist/api/sportal365-sports/football/matches/types/lineup.types.d.ts.map +0 -1
  39. package/dist/api/sportal365-sports/football/matches/types/match.types.d.ts +0 -47
  40. package/dist/api/sportal365-sports/football/matches/types/match.types.d.ts.map +0 -1
  41. package/dist/api/sportal365-sports/football/matches/types/minute.types.d.ts +0 -8
  42. package/dist/api/sportal365-sports/football/matches/types/minute.types.d.ts.map +0 -1
  43. package/dist/api/sportal365-sports/football/matches/types/odds.types.d.ts +0 -80
  44. package/dist/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +0 -1
  45. package/dist/api/sportal365-sports/football/matches/types/option.types.d.ts +0 -129
  46. package/dist/api/sportal365-sports/football/matches/types/option.types.d.ts.map +0 -1
  47. package/dist/api/sportal365-sports/football/matches/types/referee.types.d.ts +0 -13
  48. package/dist/api/sportal365-sports/football/matches/types/referee.types.d.ts.map +0 -1
  49. package/dist/api/sportal365-sports/football/matches/types/statistics.types.d.ts +0 -45
  50. package/dist/api/sportal365-sports/football/matches/types/statistics.types.d.ts.map +0 -1
  51. package/dist/api/sportal365-sports/football/matches/types/status.types.d.ts +0 -13
  52. package/dist/api/sportal365-sports/football/matches/types/status.types.d.ts.map +0 -1
  53. package/dist/api/sportal365-sports/football/matches/types/team.types.d.ts +0 -17
  54. package/dist/api/sportal365-sports/football/matches/types/team.types.d.ts.map +0 -1
  55. package/dist/api/sportal365-sports/football/matches/types/winner.types.d.ts +0 -15
  56. package/dist/api/sportal365-sports/football/matches/types/winner.types.d.ts.map +0 -1
  57. package/dist/api/sportal365-sports/football/standings/index.d.ts +0 -35
  58. package/dist/api/sportal365-sports/football/standings/index.d.ts.map +0 -1
  59. package/dist/api/sportal365-sports/football/standings/standing.transformer.d.ts +0 -15
  60. package/dist/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +0 -1
  61. package/dist/api/sportal365-sports/football/standings/standing.types.d.ts +0 -71
  62. package/dist/api/sportal365-sports/football/standings/standing.types.d.ts.map +0 -1
  63. package/dist/api/sportal365-sports/football/teams/index.d.ts +0 -25
  64. package/dist/api/sportal365-sports/football/teams/index.d.ts.map +0 -1
  65. package/dist/api/sportal365-sports/football/teams/team.types.d.ts +0 -58
  66. package/dist/api/sportal365-sports/football/teams/team.types.d.ts.map +0 -1
  67. package/dist/api/sportal365-sports/football/teams/utils.d.ts +0 -11
  68. package/dist/api/sportal365-sports/football/teams/utils.d.ts.map +0 -1
  69. package/dist/api/sportal365-sports/http.d.ts +0 -54
  70. package/dist/api/sportal365-sports/http.d.ts.map +0 -1
  71. package/dist/api/sportal365-sports/index.d.ts +0 -10
  72. package/dist/api/sportal365-sports/index.d.ts.map +0 -1
  73. package/dist/api/sportal365-sports/shared/index.d.ts +0 -5
  74. package/dist/api/sportal365-sports/shared/index.d.ts.map +0 -1
  75. package/dist/api/sportal365-sports/shared/types.d.ts +0 -189
  76. package/dist/api/sportal365-sports/shared/types.d.ts.map +0 -1
  77. package/dist/client.cjs +0 -6
  78. package/dist/client.d.ts +0 -20
  79. package/dist/client.d.ts.map +0 -1
  80. package/dist/client.js +0 -454
  81. package/dist/config/index.d.ts +0 -31
  82. package/dist/config/index.d.ts.map +0 -1
  83. package/dist/config/types.d.ts +0 -33
  84. package/dist/config/types.d.ts.map +0 -1
  85. package/dist/fansunited-data-layer.cjs +0 -1
  86. package/dist/fansunited-data-layer.js +0 -150
  87. package/dist/helpers/competition.helpers.d.ts +0 -22
  88. package/dist/helpers/competition.helpers.d.ts.map +0 -1
  89. package/dist/helpers/index.d.ts +0 -7
  90. package/dist/helpers/index.d.ts.map +0 -1
  91. package/dist/helpers/standings.helpers.d.ts +0 -70
  92. package/dist/helpers/standings.helpers.d.ts.map +0 -1
  93. package/dist/helpers/team.helpers.d.ts +0 -45
  94. package/dist/helpers/team.helpers.d.ts.map +0 -1
  95. package/dist/index-D1EJvAqY.js +0 -763
  96. package/dist/index-DbaLZvqQ.cjs +0 -1
  97. package/dist/index.d.ts +0 -31
  98. package/dist/index.d.ts.map +0 -1
  99. package/dist/providers/competition.context.d.ts +0 -8
  100. package/dist/providers/competition.context.d.ts.map +0 -1
  101. package/dist/providers/competition.provider.d.ts +0 -3
  102. package/dist/providers/competition.provider.d.ts.map +0 -1
  103. package/dist/providers/competition.types.d.ts +0 -86
  104. package/dist/providers/competition.types.d.ts.map +0 -1
  105. package/dist/providers/index.d.ts +0 -7
  106. package/dist/providers/index.d.ts.map +0 -1
  107. package/dist/types/canonical/base.types.d.ts +0 -194
  108. package/dist/types/canonical/base.types.d.ts.map +0 -1
  109. package/dist/types/canonical/commentary.types.d.ts +0 -42
  110. package/dist/types/canonical/commentary.types.d.ts.map +0 -1
  111. package/dist/types/canonical/event.types.d.ts +0 -31
  112. package/dist/types/canonical/event.types.d.ts.map +0 -1
  113. package/dist/types/canonical/index.d.ts +0 -14
  114. package/dist/types/canonical/index.d.ts.map +0 -1
  115. package/dist/types/canonical/lineup.types.d.ts +0 -33
  116. package/dist/types/canonical/lineup.types.d.ts.map +0 -1
  117. package/dist/types/canonical/match.types.d.ts +0 -142
  118. package/dist/types/canonical/match.types.d.ts.map +0 -1
  119. package/dist/types/canonical/odds.types.d.ts +0 -73
  120. package/dist/types/canonical/odds.types.d.ts.map +0 -1
  121. package/dist/types/canonical/standing.types.d.ts +0 -84
  122. package/dist/types/canonical/standing.types.d.ts.map +0 -1
  123. package/dist/types/canonical/statistics.types.d.ts +0 -27
  124. package/dist/types/canonical/statistics.types.d.ts.map +0 -1
  125. package/dist/types/index.d.ts +0 -10
  126. package/dist/types/index.d.ts.map +0 -1
  127. package/dist/vite.svg +0 -1
package/README.md CHANGED
@@ -36,8 +36,11 @@ console.log(match.score?.competitorOne); // "2"
36
36
 
37
37
  Initialize the library with your API credentials.
38
38
 
39
+ **Sportal365 Sports API:**
40
+
39
41
  ```typescript
40
42
  setConfig({
43
+ defaultSportsProvider: "sportal365Sports",
41
44
  sportal365Sports: {
42
45
  username: string; // API username
43
46
  password: string; // API password
@@ -49,6 +52,52 @@ setConfig({
49
52
  });
50
53
  ```
51
54
 
55
+ **Fans United Sports API:**
56
+
57
+ ```typescript
58
+ setConfig({
59
+ defaultSportsProvider: "fansUnitedSportsApi",
60
+ fansUnited: {
61
+ apiKey: string; // Your Fans United API key
62
+ clientId: string; // Your Fans United client ID
63
+ }
64
+ });
65
+ ```
66
+
67
+ The domain is hardcoded to `https://football.fansunitedapi.com` and timeout defaults to 30 seconds.
68
+
69
+ ### Fans United Football API
70
+
71
+ The library also supports the Fans United Football API as an alternative data provider. Use the same functions as above, but configure with Fans United credentials:
72
+
73
+ ```typescript
74
+ setConfig({
75
+ defaultSportsProvider: "fansUnitedSportsApi",
76
+ fansUnited: {
77
+ apiKey: "your-api-key",
78
+ clientId: "your-client-id",
79
+ },
80
+ });
81
+
82
+ // Now all football functions will use Fans United API
83
+ const match = await getFootballMatch("match-id");
84
+ const matches = await getFansUnitedFootballMatches({
85
+ teams: ["team-id"],
86
+ dateFrom: "2024-01-01",
87
+ dateTo: "2024-12-31",
88
+ });
89
+ ```
90
+
91
+ **Available Fans United endpoints:**
92
+
93
+ - `getFansUnitedFootballMatches(options)` - Get multiple matches with filtering
94
+ - `getFansUnitedFootballCompetition(competitionId)` - Get competition details
95
+ - `getFansUnitedFootballCompetitions(options)` - Get list of competitions
96
+ - `getFansUnitedFootballTeam(teamId)` - Get team details
97
+ - `getFansUnitedFootballPlayer(playerId)` - Get player details
98
+
99
+ All responses are transformed to the same canonical `FUSports` types for consistency.
100
+
52
101
  ### Football Endpoints
53
102
 
54
103
  #### `getFootballMatch(matchId, options?)`
@@ -131,6 +180,43 @@ console.log(team.name);
131
180
  console.log(team.assets?.logo);
132
181
  ```
133
182
 
183
+ #### `searchFootball(query, options?)`
184
+
185
+ Search for football entities (teams, players, tournaments).
186
+
187
+ ```typescript
188
+ const results = await searchFootball("Manchester United", {
189
+ entityTypes: ["TEAM", "TOURNAMENT"],
190
+ languageCode: "en",
191
+ });
192
+
193
+ results.forEach((result) => {
194
+ console.log(`${result.entityType}: ${result.name}`);
195
+ });
196
+ ```
197
+
198
+ **Options:**
199
+
200
+ - `entityTypes` - Array of: `'TEAM'`, `'PLAYER'`, `'TOURNAMENT'`
201
+ - `languageCode` - Override default language
202
+
203
+ #### `search(query, options?)`
204
+
205
+ Cross-sport search for entities across all sports.
206
+
207
+ ```typescript
208
+ const results = await search("Ronaldo", {
209
+ sports: ["FOOTBALL", "BASKETBALL"],
210
+ entityTypes: ["PLAYER"],
211
+ });
212
+ ```
213
+
214
+ **Options:**
215
+
216
+ - `sports` - Array of sport types to search in
217
+ - `entityTypes` - Array of entity types to search for
218
+ - `languageCode` - Override default language
219
+
134
220
  ## React Providers (Client Components)
135
221
 
136
222
  For React Server Components (RSC) compatibility, client-side exports are available from a separate entry point:
@@ -169,34 +255,169 @@ function App() {
169
255
 
170
256
  **Available client exports:**
171
257
 
172
- - `CompetitionProvider` - React context provider for competition data
173
- - `useCompetition` - Hook to access competition context
174
- - `CompetitionContext` - Raw context (for advanced use cases)
258
+ - `CompetitionProvider` / `useCompetition` - Competition data and helper functions
259
+ - `TeamProvider` / `useTeam` - Team data, form stats, and match helpers
260
+ - `MatchProvider` / `useMatch` - Match data with lineups, events, statistics, odds, and commentary
261
+ - `FansUnitedConfigProvider` / `useFansUnitedConfig` - SDK configuration and authentication
262
+
263
+ ### Match Provider
264
+
265
+ The `MatchProvider` offers comprehensive match data management with built-in helper hooks:
266
+
267
+ ```typescript
268
+ "use client";
269
+
270
+ import { MatchProvider, useMatch } from "fansunited-data-layer/client";
271
+
272
+ function MatchDetails() {
273
+ const {
274
+ match,
275
+ lineups,
276
+ events,
277
+ statistics,
278
+ odds,
279
+ commentary,
280
+ // Helper hooks
281
+ getScore,
282
+ getHomeTeam,
283
+ getAwayTeam,
284
+ isLive,
285
+ getGoals,
286
+ getCards,
287
+ // ... and many more
288
+ } = useMatch();
289
+
290
+ return (
291
+ <div>
292
+ <h1>{getHomeTeam().name} vs {getAwayTeam().name}</h1>
293
+ <p>Score: {getScore().home} - {getScore().away}</p>
294
+ {isLive() && <span>LIVE</span>}
295
+ </div>
296
+ );
297
+ }
298
+
299
+ function App() {
300
+ return (
301
+ <MatchProvider
302
+ match={matchData}
303
+ lineups={lineupsData}
304
+ events={eventsData}
305
+ statistics={statisticsData}
306
+ odds={oddsData}
307
+ commentary={commentaryData}
308
+ standings={standingsData}
309
+ headToHead={h2hData}
310
+ >
311
+ <MatchDetails />
312
+ </MatchProvider>
313
+ );
314
+ }
315
+ ```
175
316
 
176
317
  **Note:** Server-safe functions (`setConfig`, `getFootballMatch`, etc.) should be imported from the main entry point `'fansunited-data-layer'`, not from `'/client'`.
177
318
 
319
+ ## Statistical Utilities
320
+
321
+ The library includes powerful statistical calculation functions for match and team analysis:
322
+
323
+ ```typescript
324
+ import {
325
+ calculateH2HStats,
326
+ getTeamGoalStats,
327
+ calculateStreak,
328
+ getTeamOverUnderStats,
329
+ getTeamsCommonOpponents,
330
+ } from "fansunited-data-layer";
331
+
332
+ // Head-to-head analysis
333
+ const h2hStats = calculateH2HStats(matches, "team-1-id", "team-2-id");
334
+ console.log(h2hStats.team1Wins, h2hStats.draws, h2hStats.team2Wins);
335
+
336
+ // Goal statistics
337
+ const goalStats = getTeamGoalStats(matches, "team-id");
338
+ console.log(goalStats.scored, goalStats.conceded, goalStats.avgScored);
339
+
340
+ // Streak analysis
341
+ const streak = calculateStreak(matches, "team-id");
342
+ console.log(streak.type, streak.count); // e.g., "WIN", 5
343
+
344
+ // Over/Under statistics
345
+ const overUnder = getTeamOverUnderStats(matches, "team-id", 2.5);
346
+ console.log(overUnder.over, overUnder.under, overUnder.overPercentage);
347
+ ```
348
+
178
349
  ## Canonical Types
179
350
 
180
351
  All responses are transformed to provider-agnostic canonical types prefixed with `FUSports`:
181
352
 
182
- - `FUSportsMatch` - Full match data
183
- - `FUSportsMatchEvent` - Goals, cards, substitutions
184
- - `FUSportsMatchLineups` - Team lineups and formations
185
- - `FUSportsMatchStatistics` - Match statistics
186
- - `FUSportsMatchOdds` - Betting odds
187
- - `FUSportsCommentaryItem` - Commentary entries
188
- - `FUSportsCompetitor` - Team/competitor data
353
+ **Match Types:**
354
+
355
+ - `FUSportsMatch` - Full match data with scores, status, timing, and competitors
356
+ - `FUSportsMatchEvent` - Goals, cards, substitutions, and other match events
357
+ - `FUSportsMatchLineups` - Team lineups with formations and player details
358
+ - `FUSportsMatchStatistics` - Match statistics (possession, shots, passes, etc.)
359
+ - `FUSportsMatchOdds` - Betting odds from various operators
360
+ - `FUSportsCommentaryItem` - Live text commentary entries
361
+ - `FUSportsMatchScore` - Score information including halftime, fulltime, and penalties
362
+ - `FUSportsMatchStatus` - Match status (not started, live, finished, etc.)
363
+
364
+ **Competitor Types:**
365
+
366
+ - `FUSportsCompetitor` - Team/competitor data (discriminated union: team, player, or pair)
367
+ - `FUSportsTeamCompetitor` - Team-specific competitor data
368
+ - `FUSportsPlayerCompetitor` - Player-specific competitor data
369
+ - `FUSportsPairCompetitor` - Pair competitor data (for doubles sports)
370
+
371
+ **Competition & Standing Types:**
372
+
189
373
  - `FUSportsCompetition` - Tournament/league data
190
- - `FUSportsPlayer` - Player data
374
+ - `FUSportsStandings` - League standings with team rankings
375
+ - `FUSportsStandingEntry` - Individual team standing entry
376
+
377
+ **Player & Squad Types:**
378
+
379
+ - `FUSportsMember` - Team member/player data (for squads, lineups, events)
380
+ - `FUSportsSquadMember` - Squad member with statistics
381
+ - `FUSportsLineupMember` - Lineup player with position and formation data
382
+ - `FUSportsPlayerSeasonStatistics` - Player season statistics
383
+ - `FUSportsPlayerMatchStats` - Player match statistics (goals, assists, shots, etc.)
384
+
385
+ **Search Types:**
386
+
387
+ - `FUSportsTournamentSearchResult` - Tournament search result
388
+ - `FUSportsTeamSearchResult` - Team search result
389
+ - `FUSportsPlayerSearchResult` - Player search result
191
390
 
192
391
  ## TypeScript
193
392
 
194
393
  Full TypeScript support with exported types:
195
394
 
196
395
  ```typescript
197
- import type { FUSportsMatch, FUSportsMatchEvent, FUSportsCompetitor } from "fansunited-data-layer";
396
+ import type {
397
+ FUSportsMatch,
398
+ FUSportsMatchEvent,
399
+ FUSportsCompetitor,
400
+ FUSportsMatchLineups,
401
+ FUSportsMatchStatistics,
402
+ } from "fansunited-data-layer";
198
403
  ```
199
404
 
405
+ ## Features
406
+
407
+ - ✅ **Multi-provider support** - Sportal365 Sports API and Fans United Football API
408
+ - ✅ **Canonical types** - Provider-agnostic data structures for consistency
409
+ - ✅ **TypeScript first** - Full type safety with comprehensive type definitions
410
+ - ✅ **React Server Components** - Separate client/server entry points for RSC compatibility
411
+ - ✅ **React Providers** - Context providers for Competition, Team, and Match data
412
+ - ✅ **Statistical utilities** - Built-in functions for H2H, streaks, goals, and more
413
+ - ✅ **Search functionality** - Football-specific and cross-sport search
414
+ - ✅ **Next.js optimized** - Support for ISR and on-demand revalidation
415
+ - ✅ **HMR-safe configuration** - Config persists across hot module reloads
416
+
417
+ ## Configuration Persistence
418
+
419
+ The library automatically persists configuration across hot module replacement (HMR) in development environments like Next.js. You only need to call `setConfig()` once at app startup, and it will remain available even during development reloads.
420
+
200
421
  ## License
201
422
 
202
423
  MIT
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "fansunited-data-layer",
3
+ "author": "Fans United",
4
+ "description": "A TypeScript library for fetching and transforming sports data from multiple API providers. Returns clean, canonical types that are provider-agnostic.",
5
+ "homepage": "https://fansunited.com/",
3
6
  "private": false,
4
- "version": "0.0.14",
7
+ "version": "0.2.0",
5
8
  "type": "module",
6
9
  "files": [
7
10
  "dist"
@@ -24,11 +27,13 @@
24
27
  "scripts": {
25
28
  "dev": "vite",
26
29
  "build": "tsc -b && vite build",
27
- "build:lib": "vite build && tsc --project tsconfig.lib.json",
30
+ "build:lib": "vite build && tsc --project tsconfig.lib.json && sh scripts/add-use-client.sh",
31
+ "build:lib:watch": "vite build --watch",
28
32
  "lint": "eslint .",
29
33
  "preview": "vite preview"
30
34
  },
31
35
  "peerDependencies": {
36
+ "fansunited-sdk-esm": "^1.119.2",
32
37
  "fansunited-sports-ui": "^0.0.1",
33
38
  "react": "^18.0.0 || ^19.0.0",
34
39
  "react-dom": "^18.0.0 || ^19.0.0"
@@ -42,6 +47,7 @@
42
47
  "eslint": "^9.39.1",
43
48
  "eslint-plugin-react-hooks": "^7.0.1",
44
49
  "eslint-plugin-react-refresh": "^0.4.24",
50
+ "fansunited-sdk-esm": "^1.119.2",
45
51
  "fansunited-sports-ui": "^0.0.1",
46
52
  "globals": "^16.5.0",
47
53
  "prettier": "^3.7.3",
@@ -1,12 +0,0 @@
1
- /**
2
- * Sportal365 API Domain Constants
3
- *
4
- * Each Sportal365 API has its own domain based on the sport/functionality.
5
- */
6
- /** Football API domain */
7
- export declare const SPORTAL365_FOOTBALL_DOMAIN = "https://football.api.sportal365.com";
8
- /** Basketball API domain */
9
- export declare const SPORTAL365_BASKETBALL_DOMAIN = "https://basketball.api.sportal365.com";
10
- /** Tennis API domain */
11
- export declare const SPORTAL365_TENNIS_DOMAIN = "https://tennis.api.sportal365.com";
12
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/api/sportal365-sports/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0BAA0B;AAC1B,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,4BAA4B;AAC5B,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAEpF,wBAAwB;AACxB,eAAO,MAAM,wBAAwB,sCAAsC,CAAC"}
@@ -1,148 +0,0 @@
1
- /**
2
- * Competition types for Sportal365 Sports API
3
- * Types for tournament/competition entity responses
4
- */
5
- import type { NextCacheOptions } from "../../http";
6
- /**
7
- * Country in tournament response (v1 format)
8
- */
9
- export interface RawTournamentCountry {
10
- id: number;
11
- name: string;
12
- slug: string;
13
- uuid: string;
14
- url_flag?: string;
15
- }
16
- /**
17
- * Season in tournament response
18
- */
19
- export interface RawTournamentSeason {
20
- id: number;
21
- name: string;
22
- slug: string;
23
- active: boolean;
24
- uuid: string;
25
- }
26
- /**
27
- * Raw tournament response from /tournaments/{id}
28
- */
29
- export interface RawTournamentResponse {
30
- id: number;
31
- name: string;
32
- slug: string;
33
- country: RawTournamentCountry;
34
- regional_league: boolean;
35
- gender: "MALE" | "FEMALE";
36
- type: "LEAGUE" | "CUP";
37
- region: "DOMESTIC" | "INTERNATIONAL";
38
- uuid: string;
39
- seasons: RawTournamentSeason[];
40
- url_logo?: string;
41
- }
42
- /**
43
- * Country in v2 season details response
44
- */
45
- export interface RawSeasonDetailsCountry {
46
- id: string;
47
- name: string;
48
- slug: string;
49
- code: string | null;
50
- assets?: {
51
- flag?: {
52
- url: string;
53
- };
54
- };
55
- uuid: string;
56
- }
57
- /**
58
- * Tournament in v2 season details response
59
- */
60
- export interface RawSeasonDetailsTournament {
61
- id: string;
62
- name: string;
63
- slug: string;
64
- country: RawSeasonDetailsCountry;
65
- gender: "MALE" | "FEMALE";
66
- type: "LEAGUE" | "CUP";
67
- region: "DOMESTIC" | "INTERNATIONAL";
68
- assets?: {
69
- logo?: {
70
- url: string;
71
- };
72
- };
73
- uuid: string;
74
- }
75
- /**
76
- * Season in v2 season details response
77
- */
78
- export interface RawSeasonDetailsSeason {
79
- id: string;
80
- name: string;
81
- slug: string;
82
- tournament: RawSeasonDetailsTournament;
83
- status: "ACTIVE" | "INACTIVE";
84
- uuid: string;
85
- }
86
- /**
87
- * Round in v2 season details response
88
- */
89
- export interface RawSeasonDetailsRound {
90
- id: string;
91
- key: string;
92
- name: string;
93
- type: "LEAGUE" | "CUP" | "QUALIFICATION" | "PLAYOFF";
94
- status: "ACTIVE" | "INACTIVE";
95
- start_date: string;
96
- end_date: string;
97
- uuid: string;
98
- }
99
- /**
100
- * Stage in v2 season details response
101
- */
102
- export interface RawSeasonDetailsStage {
103
- id: string;
104
- name: string;
105
- slug: string;
106
- type: "LEAGUE" | "CUP" | "GROUP" | "KNOCKOUT" | "PLAYOFF" | "QUALIFICATION";
107
- status: "ACTIVE" | "INACTIVE";
108
- coverage: "LIVE" | "HIGHLIGHTS" | "NONE";
109
- order_in_season: number;
110
- start_date: string;
111
- end_date: string;
112
- short_name: string | null;
113
- uuid: string;
114
- }
115
- /**
116
- * Stage with rounds in v2 season details response
117
- */
118
- export interface RawSeasonDetailsStageWithRounds {
119
- stage: RawSeasonDetailsStage;
120
- rounds: RawSeasonDetailsRound[];
121
- uuid: string;
122
- }
123
- /**
124
- * Full response from /v2/seasons/details endpoint
125
- */
126
- export interface RawSeasonDetailsResponse {
127
- season: RawSeasonDetailsSeason;
128
- stages: RawSeasonDetailsStageWithRounds[];
129
- }
130
- export interface GetFootballCompetitionOptions {
131
- /** Language code for translations (e.g., 'en', 'bg'). Defaults to 'en' */
132
- languageCode?: string;
133
- /** Next.js cache options for ISR/on-demand revalidation */
134
- next?: NextCacheOptions;
135
- }
136
- export interface GetFootballSeasonDetailsOptions {
137
- /** Season ID to fetch details for */
138
- seasonId?: string;
139
- /** Tournament/competition ID (used with status to get current season) */
140
- competitionId?: string;
141
- /** Season status filter (e.g., 'CURRENT'). Used with competitionId */
142
- status?: "CURRENT";
143
- /** Language code for translations (e.g., 'en', 'bg'). Defaults to 'en' */
144
- languageCode?: string;
145
- /** Next.js cache options for ISR/on-demand revalidation */
146
- next?: NextCacheOptions;
147
- }
148
- //# sourceMappingURL=competition.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"competition.types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/competitions/competition.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMnD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,oBAAoB,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,MAAM,EAAE,UAAU,GAAG,eAAe,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,EAAE,EAA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API - Football Competitions
3
- *
4
- * Fetches competition/tournament data and transforms to canonical FUSports types.
5
- */
6
- import type { FUSportsCompetition, FUSportsSeasonDetails } from "../../../../types/canonical";
7
- import type { GetFootballCompetitionOptions, GetFootballSeasonDetailsOptions } from "./competition.types";
8
- export type { GetFootballCompetitionOptions, GetFootballSeasonDetailsOptions } from "./competition.types";
9
- /**
10
- * Get a football competition/tournament by ID
11
- *
12
- * Fetches full competition details including all available seasons.
13
- *
14
- * @param competitionId - The competition ID, UUID, or slug
15
- * @param options - Optional parameters
16
- * @returns Canonical FUSportsCompetition with all seasons
17
- *
18
- * @example
19
- * ```typescript
20
- * const competition = await getFootballCompetition('3');
21
- * console.log(competition.name); // "Premier League"
22
- * console.log(competition.seasons?.length); // 27
23
- * ```
24
- */
25
- export declare function getFootballCompetition(competitionId: string, options?: GetFootballCompetitionOptions): Promise<FUSportsCompetition>;
26
- /**
27
- * Get detailed season information with stages and rounds
28
- *
29
- * Can be called with either:
30
- * - `seasonId` to get a specific season's details
31
- * - `competitionId` + `status: 'CURRENT'` to get the current season for a competition
32
- *
33
- * @param options - Options including seasonId or competitionId+status
34
- * @returns Canonical FUSportsSeasonDetails with competition, stages, and rounds
35
- *
36
- * @example
37
- * ```typescript
38
- * // Get by season ID
39
- * const season = await getFootballSeasonDetails({ seasonId: '7575016' });
40
- * console.log(season.name); // "2025/2026"
41
- * console.log(season.stages?.length); // 1
42
- *
43
- * // Get current season for a competition
44
- * const currentSeason = await getFootballSeasonDetails({
45
- * competitionId: '3',
46
- * status: 'CURRENT'
47
- * });
48
- * ```
49
- */
50
- export declare function getFootballSeasonDetails(options?: GetFootballSeasonDetailsOptions): Promise<FUSportsSeasonDetails>;
51
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/competitions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAG9F,OAAO,KAAK,EAGR,6BAA6B,EAC7B,+BAA+B,EAClC,MAAM,qBAAqB,CAAC;AAI7B,YAAY,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAE1G;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CACxC,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,6BAAkC,GAC5C,OAAO,CAAC,mBAAmB,CAAC,CAY9B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,wBAAwB,CAC1C,OAAO,GAAE,+BAAoC,GAC9C,OAAO,CAAC,qBAAqB,CAAC,CA2BhC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Competition transformers for Sportal365 Sports API
3
- */
4
- import type { FUSportsCompetition, FUSportsSeasonDetails } from "../../../../types/canonical";
5
- import type { RawTournamentResponse, RawSeasonDetailsResponse } from "./competition.types";
6
- /**
7
- * Transform raw tournament response to canonical FUSportsCompetition
8
- */
9
- export declare function transformCompetition(raw: RawTournamentResponse): FUSportsCompetition;
10
- /**
11
- * Transform raw season details response to canonical FUSportsSeasonDetails
12
- */
13
- export declare function transformSeasonDetails(raw: RawSeasonDetailsResponse): FUSportsSeasonDetails;
14
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/sportal365-sports/football/competitions/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EAGxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACR,qBAAqB,EACrB,wBAAwB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,mBAAmB,CA4BpF;AAiCD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,wBAAwB,GAAG,qBAAqB,CAoC3F"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Football HTTP client for Sportal365 API
3
- */
4
- /**
5
- * HTTP client configured for the Sportal365 Football API
6
- */
7
- export declare const footballHttp: import("../http").Sportal365HttpClient;
8
- //# sourceMappingURL=http.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/sportal365-sports/football/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,eAAO,MAAM,YAAY,wCAA+C,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Sportal365 Sports API - Football
3
- *
4
- * Football-specific endpoints for the Sportal365 Sports API.
5
- * All functions return canonical FUSports types.
6
- */
7
- export { getFootballMatch, getFootballMatchEvents, getFootballMatchLineups, getFootballMatchOdds, getFootballMatchStatistics, getFootballMatchCommentary, getFootballMatches, } from "./matches";
8
- export type { GetFootballMatchOptions, GetFootballMatchEventsOptions, GetFootballMatchLineupsOptions, GetFootballMatchOddsOptions, GetFootballMatchStatisticsOptions, GetFootballMatchCommentaryOptions, GetFootballMatchesOptions, OddType, ScopeType, OddFormat, MarketType, OptionalMatchData, MatchStatusType, SortDirection, } from "./matches";
9
- export { getFootballTeam } from "./teams";
10
- export type { GetFootballTeamOptions } from "./teams";
11
- export { getFootballCompetition, getFootballSeasonDetails } from "./competitions";
12
- export type { GetFootballCompetitionOptions, GetFootballSeasonDetailsOptions } from "./competitions";
13
- export { getFootballStandings } from "./standings";
14
- export type { GetFootballStandingsOptions, FootballStandingsExpandOption } from "./standings";
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/sportal365-sports/football/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,GACrB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACR,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,iCAAiC,EACjC,iCAAiC,EACjC,yBAAyB,EACzB,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAClF,YAAY,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAGrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC"}