@claudinho/core 0.8.6 → 0.8.7
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 +26 -1
- package/dist/index.js +17 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -626,6 +626,31 @@ interface MatchByIdResult {
|
|
|
626
626
|
* nothing rather than something wrong).
|
|
627
627
|
*/
|
|
628
628
|
declare function marketFixtureForTeam(adapter: ProviderAdapter, code: string, now?: Date): Promise<MatchByIdResult>;
|
|
629
|
+
interface NextFixtureResult {
|
|
630
|
+
fixture?: Match;
|
|
631
|
+
/** True when the live overlay fetch failed and only the static skeleton was used. */
|
|
632
|
+
degraded: boolean;
|
|
633
|
+
/** The provider that served the live overlay (absent when degraded). */
|
|
634
|
+
source?: string;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* A team's next UPCOMING fixture, LIVE-RESOLVED across the knockout phase.
|
|
638
|
+
*
|
|
639
|
+
* The bundled schedule's knockout slots are resultless placeholders (home/away
|
|
640
|
+
* are slot refs like "Group A winner", never a nation — see
|
|
641
|
+
* {@link sanitizeBundledFixture}), so a purely static lookup goes blind the
|
|
642
|
+
* moment a team's last GROUP game passes: `next MEX` answers "no upcoming
|
|
643
|
+
* fixture" even after ESPN has confirmed Mexico's Round-of-32 tie. Overlay the
|
|
644
|
+
* live knockout window (the SAME single fetch {@link getBracket} uses) so the
|
|
645
|
+
* merged set carries the resolved nations, then pick the team's next fixture
|
|
646
|
+
* with kickoff ≥ now. (Strictly upcoming — the in-play match is `getLiveMatches`'
|
|
647
|
+
* job, preserving the pre-overlay `next` semantics.)
|
|
648
|
+
*
|
|
649
|
+
* Fails closed: on any provider error it falls back to the static result
|
|
650
|
+
* (`degraded: true`), so a feed outage degrades to "no fixture" rather than
|
|
651
|
+
* inventing one — advancement is never read from the static skeleton.
|
|
652
|
+
*/
|
|
653
|
+
declare function getNextFixtureForTeam(adapter: ProviderAdapter, code: string, now?: Date): Promise<NextFixtureResult>;
|
|
629
654
|
/**
|
|
630
655
|
* A single match by id, with live overlay. The provider's scoreboard buckets
|
|
631
656
|
* days in its own zone (ESPN: US/Eastern), so a fixture's UTC date can differ
|
|
@@ -1099,4 +1124,4 @@ declare function formatShareBracket(input: ShareBracketInput, options?: ShareBra
|
|
|
1099
1124
|
/** Compact one-line-per-match bracket for narrow share contexts. */
|
|
1100
1125
|
declare function formatBracketCompactLine(mv: BracketMatchView, opts?: BracketFormatOpts): string;
|
|
1101
1126
|
|
|
1102
|
-
export { BRACKET_STAGE_ORDER, type BracketFormatOpts, type BracketMatchNode, type BracketMatchView, type BracketResult, type BracketTopology, type BracketView, type BuildSignalInput, DEFAULT_COMPETITION, DEFAULT_FLAVOR, DEFAULT_MAX_AGE_MS, EspnAdapter, type EspnAdapterOptions, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, LIVE_WINDOW_MS, type Lang, type LedgerRow, type LiveResult, type MapContext, type MarketFavorite, type MarketMapping, type MarketMappingTable, type MarketOutcome, type MarketOutcomeKind, type MarketProvider, type MarketSignal, type MarketSignalOptions, type MarketSignalsResult, type Match, type MatchByIdResult, type MatchEvent, type Outcome, PolymarketProvider, type PolymarketProviderOptions, type ProviderAdapter, type ProviderCapabilities, type PunditPick, type ResolvedParticipant, SHARE_DISCLAIMER, SHARE_HASHTAG, type ShareBracketInput, type ShareBracketOptions, type ShareSnippetInput, type ShareSnippetOptions, type ShareStyle, type ShareTableInput, type SlotRef, type Stage, type StandingRow, type StandingsResult, type Status, type Team, allFixtures, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketCompactLine, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isStaleSignal, isValidDate, isValidTimeZone, liveSourceLabel, loadBracketTopology, localDate, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, scoreline, stageLabel, stageLabelI18n, t };
|
|
1127
|
+
export { BRACKET_STAGE_ORDER, type BracketFormatOpts, type BracketMatchNode, type BracketMatchView, type BracketResult, type BracketTopology, type BracketView, type BuildSignalInput, DEFAULT_COMPETITION, DEFAULT_FLAVOR, DEFAULT_MAX_AGE_MS, EspnAdapter, type EspnAdapterOptions, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, LIVE_WINDOW_MS, type Lang, type LedgerRow, type LiveResult, type MapContext, type MarketFavorite, type MarketMapping, type MarketMappingTable, type MarketOutcome, type MarketOutcomeKind, type MarketProvider, type MarketSignal, type MarketSignalOptions, type MarketSignalsResult, type Match, type MatchByIdResult, type MatchEvent, type NextFixtureResult, type Outcome, PolymarketProvider, type PolymarketProviderOptions, type ProviderAdapter, type ProviderCapabilities, type PunditPick, type ResolvedParticipant, SHARE_DISCLAIMER, SHARE_HASHTAG, type ShareBracketInput, type ShareBracketOptions, type ShareSnippetInput, type ShareSnippetOptions, type ShareStyle, type ShareTableInput, type SlotRef, type Stage, type StandingRow, type StandingsResult, type Status, type Team, allFixtures, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketCompactLine, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getNextFixtureForTeam, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isStaleSignal, isValidDate, isValidTimeZone, liveSourceLabel, loadBracketTopology, localDate, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, scoreline, stageLabel, stageLabelI18n, t };
|
package/dist/index.js
CHANGED
|
@@ -4152,6 +4152,22 @@ async function marketFixtureForTeam(adapter, code, now = /* @__PURE__ */ new Dat
|
|
|
4152
4152
|
const next = nextFixtureForTeam(code, { from: now });
|
|
4153
4153
|
return { match: next, degraded: false };
|
|
4154
4154
|
}
|
|
4155
|
+
async function getNextFixtureForTeam(adapter, code, now = /* @__PURE__ */ new Date()) {
|
|
4156
|
+
const base = allFixtures();
|
|
4157
|
+
let matches = base;
|
|
4158
|
+
let degraded = true;
|
|
4159
|
+
let liveById;
|
|
4160
|
+
try {
|
|
4161
|
+
const live = adapter.fetchWindow ? await adapter.fetchWindow(KNOCKOUT_WINDOW_START, KNOCKOUT_WINDOW_END) : [];
|
|
4162
|
+
matches = mergeLive(base, live);
|
|
4163
|
+
degraded = false;
|
|
4164
|
+
liveById = new Set(live.map((m) => m.id));
|
|
4165
|
+
} catch {
|
|
4166
|
+
}
|
|
4167
|
+
const fixture = nextFixtureForTeam(code, { from: now, fixtures: matches });
|
|
4168
|
+
const source = fixture && liveById?.has(fixture.id) ? adapter.name : void 0;
|
|
4169
|
+
return { fixture, degraded, source };
|
|
4170
|
+
}
|
|
4155
4171
|
async function getMatchById(adapter, id) {
|
|
4156
4172
|
const base = allFixtures().find((m) => m.id === id);
|
|
4157
4173
|
if (!base) return { match: void 0, degraded: false };
|
|
@@ -4914,6 +4930,7 @@ export {
|
|
|
4914
4930
|
getMarketSignals,
|
|
4915
4931
|
getMatchById,
|
|
4916
4932
|
getMatchesForDate,
|
|
4933
|
+
getNextFixtureForTeam,
|
|
4917
4934
|
getStandings,
|
|
4918
4935
|
groups,
|
|
4919
4936
|
hasSaneDistribution,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudinho/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
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",
|