@claudinho/core 0.9.2 → 0.9.3
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 +10 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -401,6 +401,31 @@ declare const LIVE_WINDOW_MS: number;
|
|
|
401
401
|
declare const KNOCKOUT_EXTRA_TIME_MS: number;
|
|
402
402
|
/** Live-window length for a fixture — longer for knockout (extra time + penalties). */
|
|
403
403
|
declare function liveWindowMsFor(m: Match): number;
|
|
404
|
+
/**
|
|
405
|
+
* True once EVERY bundled fixture's (stage-aware) live window has ELAPSED —
|
|
406
|
+
* derived from the bundled schedule rather than a hardcoded date (same reasoning
|
|
407
|
+
* as the derived knockout window: the `CLAUDINHO_COMPETITION` seam must not carry
|
|
408
|
+
* a dead calendar).
|
|
409
|
+
*
|
|
410
|
+
* Named for exactly what it measures. This is a TIME predicate, not proof that
|
|
411
|
+
* every match was played: the bundled schedule is a **resultless skeleton** (every
|
|
412
|
+
* fixture ships `SCHEDULED` by design), so status can't inform it — a POSTPONED or
|
|
413
|
+
* abandoned fixture still reads as elapsed once its window passes. That is
|
|
414
|
+
* acceptable for the only use it has (turning a spent schedule into a sign-off),
|
|
415
|
+
* and it's why this is not called `isTournamentComplete`. **Make it status-aware
|
|
416
|
+
* against the live overlay before reusing it for anything that asserts results.**
|
|
417
|
+
*
|
|
418
|
+
* Deliberately a GLOBAL condition, independent of any team filter: an eliminated
|
|
419
|
+
* team mid-tournament has no next fixture either, and must NOT read as "over".
|
|
420
|
+
* Every other empty case still fails closed to the neutral `⚽ —`.
|
|
421
|
+
*
|
|
422
|
+
* Callers must additionally confirm the bundled schedule even applies — it
|
|
423
|
+
* describes the DEFAULT competition, so `CLAUDINHO_COMPETITION` pointing elsewhere
|
|
424
|
+
* makes this answer meaningless (see the `DEFAULT_COMPETITION` gates in the CLI).
|
|
425
|
+
*
|
|
426
|
+
* Empty fixture list → false: "we know nothing" is not "it's over".
|
|
427
|
+
*/
|
|
428
|
+
declare function isTournamentWindowOver(now?: number, fixtures?: Match[]): boolean;
|
|
404
429
|
/** Fixtures whose (stage-aware) live window contains `now` (cheap, static — no network). */
|
|
405
430
|
declare function fixturesInLiveWindow(now?: number, fixtures?: Match[]): Match[];
|
|
406
431
|
/**
|
|
@@ -1293,4 +1318,4 @@ declare function formatShareBracket(input: ShareBracketInput, options?: ShareBra
|
|
|
1293
1318
|
/** Compact one-line-per-match bracket for narrow share contexts. */
|
|
1294
1319
|
declare function formatBracketCompactLine(mv: BracketMatchView, opts?: BracketFormatOpts): string;
|
|
1295
1320
|
|
|
1296
|
-
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, FEED_TEXT_MAX, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, KNOCKOUT_EXTRA_TIME_MS, KNOWN_SOURCES, type KnockoutFixturesResult, 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, ProviderError, type ProviderErrorKind, 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, type TeamInfo, type TeamLookup, allFixtures, allTeams, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, displayWidth, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketCompactLine, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getKnockoutFixtures, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getNextFixtureForTeam, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isResolvedNation, isStaleSignal, isValidDate, isValidTimeZone, knockoutWindow, liveSourceLabel, liveWindowMsFor, loadBracketTopology, localDate, lookupTeam, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSignalRendersFor, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, padVisible, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, sanitizeFeedText, sanitizeMatchStrings, scoreline, stageLabel, stageLabelI18n, t };
|
|
1321
|
+
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, FEED_TEXT_MAX, FLAVOR_LEVELS, FakeMarketProvider, type FakeMarketProviderOptions, type FavoriteStrength, type FlavorLevel, type FormatOpts, type GroupStandings, KNOCKOUT_EXTRA_TIME_MS, KNOWN_SOURCES, type KnockoutFixturesResult, 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, ProviderError, type ProviderErrorKind, 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, type TeamInfo, type TeamLookup, allFixtures, allTeams, asFlavorLevel, buildBracketTopology, buildBracketView, buildMarketSignal, byKickoff, competitionBase, computeStandings, countdown, currentOrNextFixtureForTeam, deriveFavorite, displayWidth, favoriteStrength, fixturesByDate, fixturesByGroup, fixturesByTeam, fixturesInLiveWindow, flagEmoji, formatBracketCompactLine, formatBracketList, formatBracketMatchLine, formatBracketTree, formatDate, formatKickoff, formatShareBracket, formatShareSnippet, formatShareTable, formatTime, getBracket, getKnockoutFixtures, getLiveMatches, getMarketSignal, getMarketSignals, getMatchById, getMatchesForDate, getNextFixtureForTeam, getStandings, groups, hasSaneDistribution, isFinished, isFlavorLevel, isLive, isReliableMarketSignal, isResolvedNation, isStaleSignal, isTournamentWindowOver, isValidDate, isValidTimeZone, knockoutWindow, liveSourceLabel, liveWindowMsFor, loadBracketTopology, localDate, lookupTeam, makeAdapter, makeMarketProvider, mapEspnEvent, mapsCleanly, marketAttributionText, marketBlock, marketFavoriteText, marketFixtureForTeam, marketLine, marketProbabilityText, marketRelevant, marketSignalRendersFor, marketSourceLabel, matchFlavor, matchKey, matchLocation, mergeLive, nationToFlag, nationToRegion, nextFixtureForTeam, normalizeLang, normalizeOutcomes, outcomeFromScore, padVisible, parseStandings, parseTeamSlot, resolveCompetition, resolveMarketSource, resolveTz, sanitizeBundledFixture, sanitizeFeedText, sanitizeMatchStrings, scoreline, stageLabel, stageLabelI18n, t };
|
package/dist/index.js
CHANGED
|
@@ -2945,6 +2945,14 @@ var KNOCKOUT_EXTRA_TIME_MS = 60 * 6e4;
|
|
|
2945
2945
|
function liveWindowMsFor(m) {
|
|
2946
2946
|
return m.stage === "GROUP" || m.stage === "FRIENDLY" ? LIVE_WINDOW_MS : LIVE_WINDOW_MS + KNOCKOUT_EXTRA_TIME_MS;
|
|
2947
2947
|
}
|
|
2948
|
+
function isTournamentWindowOver(now = Date.now(), fixtures = SCHEDULE) {
|
|
2949
|
+
if (fixtures.length === 0) return false;
|
|
2950
|
+
return fixtures.every((m) => {
|
|
2951
|
+
const k = Date.parse(m.kickoff);
|
|
2952
|
+
if (Number.isNaN(k)) return false;
|
|
2953
|
+
return now > k + liveWindowMsFor(m);
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2948
2956
|
function fixturesInLiveWindow(now = Date.now(), fixtures = SCHEDULE) {
|
|
2949
2957
|
return fixtures.filter((m) => {
|
|
2950
2958
|
const k = Date.parse(m.kickoff);
|
|
@@ -3090,7 +3098,7 @@ function rosterAtZero(matches) {
|
|
|
3090
3098
|
var ESPN_SOCCER = "https://site.api.espn.com/apis/site/v2/sports/soccer";
|
|
3091
3099
|
var DEFAULT_COMPETITION = "fifa.world";
|
|
3092
3100
|
var DEFAULT_BASE = `${ESPN_SOCCER}/${DEFAULT_COMPETITION}`;
|
|
3093
|
-
var USER_AGENT = `claudinho/${"0.9.
|
|
3101
|
+
var USER_AGENT = `claudinho/${"0.9.3"} (+https://github.com/arturogarrido/claudinho)`;
|
|
3094
3102
|
var MAX_RESPONSE_BYTES = 5 * 1024 * 1024;
|
|
3095
3103
|
function competitionBase(slug) {
|
|
3096
3104
|
return `${ESPN_SOCCER}/${slug}`;
|
|
@@ -5263,6 +5271,7 @@ export {
|
|
|
5263
5271
|
isReliableMarketSignal,
|
|
5264
5272
|
isResolvedNation,
|
|
5265
5273
|
isStaleSignal,
|
|
5274
|
+
isTournamentWindowOver,
|
|
5266
5275
|
isValidDate,
|
|
5267
5276
|
isValidTimeZone,
|
|
5268
5277
|
knockoutWindow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudinho/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
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",
|