@claudinho/core 0.8.8 → 0.8.10

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/dist/index.d.ts CHANGED
@@ -49,6 +49,16 @@ interface Match {
49
49
  home: number;
50
50
  away: number;
51
51
  };
52
+ /**
53
+ * Penalty-shootout score for a knockout decided on penalties (ESPN
54
+ * `competitor.shootoutScore`; status detail "FT-Pens"). Present ONLY for
55
+ * shootout matches — `score` stays the level regulation/extra-time result, and
56
+ * `scoreline` renders e.g. "1(3)–1(4)". Live-only, never in the bundle.
57
+ */
58
+ shootout?: {
59
+ home: number;
60
+ away: number;
61
+ };
52
62
  /** Live match minute when in progress. */
53
63
  minute?: number;
54
64
  status: Status;
@@ -179,7 +189,12 @@ declare function outcomeFromScore(home: number, away: number): Outcome;
179
189
  declare function isLive(status: Status): boolean;
180
190
  /** Has the match finished in regulation/normal completion? */
181
191
  declare function isFinished(status: Status): boolean;
182
- /** Compact scoreline string, e.g. "1–0" (en dash) or "vs" when unscored. */
192
+ /**
193
+ * Compact scoreline string, e.g. "1–0" (en dash), or "vs" when unscored. A
194
+ * knockout decided on penalties appends each side's shootout score in parens —
195
+ * "1(3)–1(4)" — so the level regulation result still reads while showing who
196
+ * advanced.
197
+ */
183
198
  declare function scoreline(match: Match): string;
184
199
  /**
185
200
  * Human-readable location: venue plus city/country when the provider supplies
@@ -438,6 +453,8 @@ interface EspnTeam {
438
453
  interface EspnCompetitor {
439
454
  homeAway?: 'home' | 'away';
440
455
  score?: string;
456
+ /** Penalty-shootout tally, present only on shootout matches (ESPN sends a number). */
457
+ shootoutScore?: number | string;
441
458
  winner?: boolean;
442
459
  team?: EspnTeam;
443
460
  }
package/dist/index.js CHANGED
@@ -512,7 +512,11 @@ function isFinished(status) {
512
512
  }
513
513
  function scoreline(match) {
514
514
  if (!match.score) return "vs";
515
- return `${match.score.home}\u2013${match.score.away}`;
515
+ const { home, away } = match.score;
516
+ if (match.shootout) {
517
+ return `${home}(${match.shootout.home})\u2013${away}(${match.shootout.away})`;
518
+ }
519
+ return `${home}\u2013${away}`;
516
520
  }
517
521
  function matchLocation(match) {
518
522
  return [match.venue, match.city, match.country].filter(Boolean).join(", ");
@@ -3000,7 +3004,7 @@ function stageFromSlug(slug) {
3000
3004
  }
3001
3005
  function toInt(s) {
3002
3006
  if (s == null || s === "") return void 0;
3003
- const n = parseInt(s, 10);
3007
+ const n = parseInt(String(s), 10);
3004
3008
  return Number.isFinite(n) ? n : void 0;
3005
3009
  }
3006
3010
  function toTeam(t2) {
@@ -3029,6 +3033,9 @@ function mapEspnEvent(ev, ctx = {}) {
3029
3033
  if (homeC?.winner) winnerCode = home.code;
3030
3034
  else if (awayC?.winner) winnerCode = away.code;
3031
3035
  }
3036
+ const hShoot = toInt(homeC?.shootoutScore);
3037
+ const aShoot = toInt(awayC?.shootoutScore);
3038
+ const shootout = hasScore && hShoot !== void 0 && aShoot !== void 0 ? { home: hShoot, away: aShoot } : void 0;
3032
3039
  return {
3033
3040
  id: ev.id,
3034
3041
  stage,
@@ -3040,6 +3047,7 @@ function mapEspnEvent(ev, ctx = {}) {
3040
3047
  home,
3041
3048
  away,
3042
3049
  score: hasScore ? { home: hs, away: as } : void 0,
3050
+ shootout,
3043
3051
  minute: parseMinute(ev.status ?? comp?.status),
3044
3052
  status,
3045
3053
  winnerCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudinho/core",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "description": "Domain model, provider adapters (ESPN), standings, bundled schedule, and the read-only Polymarket market-signal sidecar powering Claudinho. Not affiliated with FIFA or Anthropic.",
5
5
  "type": "module",
6
6
  "license": "MIT",