@nukleus-sports/core 0.4.0 → 0.6.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.
package/dist/index.d.cts CHANGED
@@ -258,9 +258,13 @@ declare function getOrderedTeamStatTypesForCategory<T extends TeamStatTypeLike>(
258
258
  /** Whether this sport's stats split into categories (e.g. offense/defense) worth a picker. */
259
259
  declare function showsTeamStatCategoryPicker(sportId: number): boolean;
260
260
 
261
+ /**
262
+ * Both real apps' `LeagueSeason` row (`year`/`type`), not the Stats tab's `StatSeason` row
263
+ * (`season_year`/`season_type`) -- see RECONCILIATION.md for why.
264
+ */
261
265
  interface SeasonSelectorSeason {
262
- season_year: number;
263
- season_type: number;
266
+ year: number;
267
+ type: number;
264
268
  year_display: string;
265
269
  type_name: string;
266
270
  }
@@ -272,7 +276,7 @@ interface SeasonSelectorOption {
272
276
  declare function getPreferredSeasonType(types: number[]): number | null;
273
277
  /** Distinct years, newest first, each labeled from its first matching season. */
274
278
  declare function getSeasonYearOptions(seasons: SeasonSelectorSeason[]): SeasonSelectorOption[];
275
- /** The season types available for one year, newest type first. */
279
+ /** The season types available for one year, in both real apps' own ascending (not newest-first) order. */
276
280
  declare function getSeasonTypeOptions(seasons: SeasonSelectorSeason[], selectedYear: number | null): SeasonSelectorOption[];
277
281
 
278
282
  interface DatedGame {
@@ -585,4 +589,11 @@ interface BuildRecentGameRowsArgs {
585
589
  /** One render-ready row per game, in the order given. */
586
590
  declare function buildRecentGameRows({ games, teamId, teamEspnId, teams, espnTeams, todayStart, }: BuildRecentGameRowsArgs): RecentGameRow[];
587
591
 
588
- export { BASEBALL_TEAM_STAT_IDS, BASKETBALL_TEAM_STAT_IDS, type BuildRecentGameRowsArgs, CONFIGURED_TEAM_FACTS_LEAGUES, type DatedGame, type DealStatus, EMPTY_FACT_VALUE, FOOTBALL_TEAM_STAT_IDS, HOCKEY_TEAM_STAT_IDS, type MarketingPermission, type ProjectMemberRole, type RecentGameCompetitor, type RecentGameLogo, type RecentGameOpponent, type RecentGameOutcome, type RecentGameRecord, type RecentGameResult, type RecentGameRow, type RecentGameTeamRow, type ResolveOpponentArgs, type RosterColumnDef, type RosterColumnKey, type RosterPlayerLike, type RosterPlayerSpecificData, type SeasonRecordGame, type SeasonSelectorOption, type SeasonSelectorSeason, type SeasonSummary, type StaffMember, type StaffSort, type StatColumnDef, type StatRanking, type StatRankingFootnoteConfig, TEAM_FACT_KINDS, TEAM_FACT_YEAR_PAIRS, type TeamFacilityImage, type TeamFacilityKind, type TeamFactKey, type TeamFactKind, type TeamFacts, type TeamFactsLeagueConfig, type TeamFactsRival, type TeamFactsRivalState, type TeamFactsRivalTeamRow, type TeamFactsSectionConfig, type TeamFactsSectionLayout, type TeamFactsTeamRow, type TeamFactsWidgetData, type TeamFactsWidgetState, type TeamPlace, type TeamPlaceKind, type TeamPlaceSummary, type TeamSeasonStatEntry, type TeamSeasonStatRecord, type TeamSeasonStatTotal, type TeamSeasonStatsResult, type TeamSeasonSummaryRecord, type TeamStatTypeLike, type TeamVenue, type TeamVenueKind, abbreviatePersonName, buildRecentGameRows, canEditMarketingDeals, canEditProject, canEditTaskStatus, canManageMembers, canViewMarketingDeals, collectRecentGameEspnIds, collectRecentGameTeamIds, computeSeasonSummary, computeTeamSeasonStats, computeTeamSeasonStatsFromSummary, facilityImageCredit, fmt, fmtCurrency, fmtDate, fmtUSD, fmtUSDCompact, fmtUSDWhole, formatDealDate, formatStatNumber, formatStatRank, formatStatRankByConfig, formatSuperBowlYear, formatTeamFactNumber, formatTeamName, formatTeamPlaceAddress, formatYearPills, getDealStatus, getEffectiveMemberRole, getOrderedTeamStatTypesForCategory, getPreferredSeasonType, getRecentGameResult, getRosterCellValue, getRosterColumns, getSeasonTypeOptions, getSeasonYearOptions, getStatRankingFootnotes, getTeamFacilityConfig, getTeamFactsConfig, getTeamPlaceSummaries, getTeamRankingConfigIds, getTeamStatColumns, getTeamVenueConfig, getVisibleTeamStatTypes, hasTeamFacts, isGameBeforeDay, isGameCompleted, isJsonRecord, isProjectCancelled, isSupportedTeamStatsSport, isTrueUpcomingGame, parseTeamFacts, parseTeamPlace, parseTeamVenue, resolveRecentGameOpponent, selectRecentGames, showsTeamStatCategoryPicker, sortTeamStaff, startOfLocalDay, teamFactsDisplayFields, toJsonRecord, toOrdinal, toRivalState, toRomanNumeral, toTeamFactsView, toTrimmedText, topPercentileLabel };
592
+ /** Avatar fallback for a team: first letter of the first two words, else the first two
593
+ * characters; "T" when missing or whitespace-only. Case is preserved, not uppercased -- matching
594
+ * both real apps' original behavior. */
595
+ declare function getTeamInitials(team: string | null | undefined): string;
596
+ /** "Conference - Division" fallback when a team has neither set. */
597
+ declare function getTeamConferenceInfo(conference: string | null | undefined, division: string | null | undefined): string;
598
+
599
+ export { BASEBALL_TEAM_STAT_IDS, BASKETBALL_TEAM_STAT_IDS, type BuildRecentGameRowsArgs, CONFIGURED_TEAM_FACTS_LEAGUES, type DatedGame, type DealStatus, EMPTY_FACT_VALUE, FOOTBALL_TEAM_STAT_IDS, HOCKEY_TEAM_STAT_IDS, type MarketingPermission, type ProjectMemberRole, type RecentGameCompetitor, type RecentGameLogo, type RecentGameOpponent, type RecentGameOutcome, type RecentGameRecord, type RecentGameResult, type RecentGameRow, type RecentGameTeamRow, type ResolveOpponentArgs, type RosterColumnDef, type RosterColumnKey, type RosterPlayerLike, type RosterPlayerSpecificData, type SeasonRecordGame, type SeasonSelectorOption, type SeasonSelectorSeason, type SeasonSummary, type StaffMember, type StaffSort, type StatColumnDef, type StatRanking, type StatRankingFootnoteConfig, TEAM_FACT_KINDS, TEAM_FACT_YEAR_PAIRS, type TeamFacilityImage, type TeamFacilityKind, type TeamFactKey, type TeamFactKind, type TeamFacts, type TeamFactsLeagueConfig, type TeamFactsRival, type TeamFactsRivalState, type TeamFactsRivalTeamRow, type TeamFactsSectionConfig, type TeamFactsSectionLayout, type TeamFactsTeamRow, type TeamFactsWidgetData, type TeamFactsWidgetState, type TeamPlace, type TeamPlaceKind, type TeamPlaceSummary, type TeamSeasonStatEntry, type TeamSeasonStatRecord, type TeamSeasonStatTotal, type TeamSeasonStatsResult, type TeamSeasonSummaryRecord, type TeamStatTypeLike, type TeamVenue, type TeamVenueKind, abbreviatePersonName, buildRecentGameRows, canEditMarketingDeals, canEditProject, canEditTaskStatus, canManageMembers, canViewMarketingDeals, collectRecentGameEspnIds, collectRecentGameTeamIds, computeSeasonSummary, computeTeamSeasonStats, computeTeamSeasonStatsFromSummary, facilityImageCredit, fmt, fmtCurrency, fmtDate, fmtUSD, fmtUSDCompact, fmtUSDWhole, formatDealDate, formatStatNumber, formatStatRank, formatStatRankByConfig, formatSuperBowlYear, formatTeamFactNumber, formatTeamName, formatTeamPlaceAddress, formatYearPills, getDealStatus, getEffectiveMemberRole, getOrderedTeamStatTypesForCategory, getPreferredSeasonType, getRecentGameResult, getRosterCellValue, getRosterColumns, getSeasonTypeOptions, getSeasonYearOptions, getStatRankingFootnotes, getTeamConferenceInfo, getTeamFacilityConfig, getTeamFactsConfig, getTeamInitials, getTeamPlaceSummaries, getTeamRankingConfigIds, getTeamStatColumns, getTeamVenueConfig, getVisibleTeamStatTypes, hasTeamFacts, isGameBeforeDay, isGameCompleted, isJsonRecord, isProjectCancelled, isSupportedTeamStatsSport, isTrueUpcomingGame, parseTeamFacts, parseTeamPlace, parseTeamVenue, resolveRecentGameOpponent, selectRecentGames, showsTeamStatCategoryPicker, sortTeamStaff, startOfLocalDay, teamFactsDisplayFields, toJsonRecord, toOrdinal, toRivalState, toRomanNumeral, toTeamFactsView, toTrimmedText, topPercentileLabel };
package/dist/index.d.ts CHANGED
@@ -258,9 +258,13 @@ declare function getOrderedTeamStatTypesForCategory<T extends TeamStatTypeLike>(
258
258
  /** Whether this sport's stats split into categories (e.g. offense/defense) worth a picker. */
259
259
  declare function showsTeamStatCategoryPicker(sportId: number): boolean;
260
260
 
261
+ /**
262
+ * Both real apps' `LeagueSeason` row (`year`/`type`), not the Stats tab's `StatSeason` row
263
+ * (`season_year`/`season_type`) -- see RECONCILIATION.md for why.
264
+ */
261
265
  interface SeasonSelectorSeason {
262
- season_year: number;
263
- season_type: number;
266
+ year: number;
267
+ type: number;
264
268
  year_display: string;
265
269
  type_name: string;
266
270
  }
@@ -272,7 +276,7 @@ interface SeasonSelectorOption {
272
276
  declare function getPreferredSeasonType(types: number[]): number | null;
273
277
  /** Distinct years, newest first, each labeled from its first matching season. */
274
278
  declare function getSeasonYearOptions(seasons: SeasonSelectorSeason[]): SeasonSelectorOption[];
275
- /** The season types available for one year, newest type first. */
279
+ /** The season types available for one year, in both real apps' own ascending (not newest-first) order. */
276
280
  declare function getSeasonTypeOptions(seasons: SeasonSelectorSeason[], selectedYear: number | null): SeasonSelectorOption[];
277
281
 
278
282
  interface DatedGame {
@@ -585,4 +589,11 @@ interface BuildRecentGameRowsArgs {
585
589
  /** One render-ready row per game, in the order given. */
586
590
  declare function buildRecentGameRows({ games, teamId, teamEspnId, teams, espnTeams, todayStart, }: BuildRecentGameRowsArgs): RecentGameRow[];
587
591
 
588
- export { BASEBALL_TEAM_STAT_IDS, BASKETBALL_TEAM_STAT_IDS, type BuildRecentGameRowsArgs, CONFIGURED_TEAM_FACTS_LEAGUES, type DatedGame, type DealStatus, EMPTY_FACT_VALUE, FOOTBALL_TEAM_STAT_IDS, HOCKEY_TEAM_STAT_IDS, type MarketingPermission, type ProjectMemberRole, type RecentGameCompetitor, type RecentGameLogo, type RecentGameOpponent, type RecentGameOutcome, type RecentGameRecord, type RecentGameResult, type RecentGameRow, type RecentGameTeamRow, type ResolveOpponentArgs, type RosterColumnDef, type RosterColumnKey, type RosterPlayerLike, type RosterPlayerSpecificData, type SeasonRecordGame, type SeasonSelectorOption, type SeasonSelectorSeason, type SeasonSummary, type StaffMember, type StaffSort, type StatColumnDef, type StatRanking, type StatRankingFootnoteConfig, TEAM_FACT_KINDS, TEAM_FACT_YEAR_PAIRS, type TeamFacilityImage, type TeamFacilityKind, type TeamFactKey, type TeamFactKind, type TeamFacts, type TeamFactsLeagueConfig, type TeamFactsRival, type TeamFactsRivalState, type TeamFactsRivalTeamRow, type TeamFactsSectionConfig, type TeamFactsSectionLayout, type TeamFactsTeamRow, type TeamFactsWidgetData, type TeamFactsWidgetState, type TeamPlace, type TeamPlaceKind, type TeamPlaceSummary, type TeamSeasonStatEntry, type TeamSeasonStatRecord, type TeamSeasonStatTotal, type TeamSeasonStatsResult, type TeamSeasonSummaryRecord, type TeamStatTypeLike, type TeamVenue, type TeamVenueKind, abbreviatePersonName, buildRecentGameRows, canEditMarketingDeals, canEditProject, canEditTaskStatus, canManageMembers, canViewMarketingDeals, collectRecentGameEspnIds, collectRecentGameTeamIds, computeSeasonSummary, computeTeamSeasonStats, computeTeamSeasonStatsFromSummary, facilityImageCredit, fmt, fmtCurrency, fmtDate, fmtUSD, fmtUSDCompact, fmtUSDWhole, formatDealDate, formatStatNumber, formatStatRank, formatStatRankByConfig, formatSuperBowlYear, formatTeamFactNumber, formatTeamName, formatTeamPlaceAddress, formatYearPills, getDealStatus, getEffectiveMemberRole, getOrderedTeamStatTypesForCategory, getPreferredSeasonType, getRecentGameResult, getRosterCellValue, getRosterColumns, getSeasonTypeOptions, getSeasonYearOptions, getStatRankingFootnotes, getTeamFacilityConfig, getTeamFactsConfig, getTeamPlaceSummaries, getTeamRankingConfigIds, getTeamStatColumns, getTeamVenueConfig, getVisibleTeamStatTypes, hasTeamFacts, isGameBeforeDay, isGameCompleted, isJsonRecord, isProjectCancelled, isSupportedTeamStatsSport, isTrueUpcomingGame, parseTeamFacts, parseTeamPlace, parseTeamVenue, resolveRecentGameOpponent, selectRecentGames, showsTeamStatCategoryPicker, sortTeamStaff, startOfLocalDay, teamFactsDisplayFields, toJsonRecord, toOrdinal, toRivalState, toRomanNumeral, toTeamFactsView, toTrimmedText, topPercentileLabel };
592
+ /** Avatar fallback for a team: first letter of the first two words, else the first two
593
+ * characters; "T" when missing or whitespace-only. Case is preserved, not uppercased -- matching
594
+ * both real apps' original behavior. */
595
+ declare function getTeamInitials(team: string | null | undefined): string;
596
+ /** "Conference - Division" fallback when a team has neither set. */
597
+ declare function getTeamConferenceInfo(conference: string | null | undefined, division: string | null | undefined): string;
598
+
599
+ export { BASEBALL_TEAM_STAT_IDS, BASKETBALL_TEAM_STAT_IDS, type BuildRecentGameRowsArgs, CONFIGURED_TEAM_FACTS_LEAGUES, type DatedGame, type DealStatus, EMPTY_FACT_VALUE, FOOTBALL_TEAM_STAT_IDS, HOCKEY_TEAM_STAT_IDS, type MarketingPermission, type ProjectMemberRole, type RecentGameCompetitor, type RecentGameLogo, type RecentGameOpponent, type RecentGameOutcome, type RecentGameRecord, type RecentGameResult, type RecentGameRow, type RecentGameTeamRow, type ResolveOpponentArgs, type RosterColumnDef, type RosterColumnKey, type RosterPlayerLike, type RosterPlayerSpecificData, type SeasonRecordGame, type SeasonSelectorOption, type SeasonSelectorSeason, type SeasonSummary, type StaffMember, type StaffSort, type StatColumnDef, type StatRanking, type StatRankingFootnoteConfig, TEAM_FACT_KINDS, TEAM_FACT_YEAR_PAIRS, type TeamFacilityImage, type TeamFacilityKind, type TeamFactKey, type TeamFactKind, type TeamFacts, type TeamFactsLeagueConfig, type TeamFactsRival, type TeamFactsRivalState, type TeamFactsRivalTeamRow, type TeamFactsSectionConfig, type TeamFactsSectionLayout, type TeamFactsTeamRow, type TeamFactsWidgetData, type TeamFactsWidgetState, type TeamPlace, type TeamPlaceKind, type TeamPlaceSummary, type TeamSeasonStatEntry, type TeamSeasonStatRecord, type TeamSeasonStatTotal, type TeamSeasonStatsResult, type TeamSeasonSummaryRecord, type TeamStatTypeLike, type TeamVenue, type TeamVenueKind, abbreviatePersonName, buildRecentGameRows, canEditMarketingDeals, canEditProject, canEditTaskStatus, canManageMembers, canViewMarketingDeals, collectRecentGameEspnIds, collectRecentGameTeamIds, computeSeasonSummary, computeTeamSeasonStats, computeTeamSeasonStatsFromSummary, facilityImageCredit, fmt, fmtCurrency, fmtDate, fmtUSD, fmtUSDCompact, fmtUSDWhole, formatDealDate, formatStatNumber, formatStatRank, formatStatRankByConfig, formatSuperBowlYear, formatTeamFactNumber, formatTeamName, formatTeamPlaceAddress, formatYearPills, getDealStatus, getEffectiveMemberRole, getOrderedTeamStatTypesForCategory, getPreferredSeasonType, getRecentGameResult, getRosterCellValue, getRosterColumns, getSeasonTypeOptions, getSeasonYearOptions, getStatRankingFootnotes, getTeamConferenceInfo, getTeamFacilityConfig, getTeamFactsConfig, getTeamInitials, getTeamPlaceSummaries, getTeamRankingConfigIds, getTeamStatColumns, getTeamVenueConfig, getVisibleTeamStatTypes, hasTeamFacts, isGameBeforeDay, isGameCompleted, isJsonRecord, isProjectCancelled, isSupportedTeamStatsSport, isTrueUpcomingGame, parseTeamFacts, parseTeamPlace, parseTeamVenue, resolveRecentGameOpponent, selectRecentGames, showsTeamStatCategoryPicker, sortTeamStaff, startOfLocalDay, teamFactsDisplayFields, toJsonRecord, toOrdinal, toRivalState, toRomanNumeral, toTeamFactsView, toTrimmedText, topPercentileLabel };
package/dist/index.js CHANGED
@@ -651,15 +651,15 @@ function getPreferredSeasonType(types) {
651
651
  return Math.max(...types);
652
652
  }
653
653
  function getSeasonYearOptions(seasons) {
654
- const years = [...new Set(seasons.map((s) => s.season_year))].sort((a, b) => b - a);
654
+ const years = [...new Set(seasons.map((s) => s.year))].sort((a, b) => b - a);
655
655
  return years.map((year) => ({
656
656
  value: year,
657
- label: seasons.find((s) => s.season_year === year)?.year_display ?? String(year)
657
+ label: seasons.find((s) => s.year === year)?.year_display ?? String(year)
658
658
  }));
659
659
  }
660
660
  function getSeasonTypeOptions(seasons, selectedYear) {
661
661
  if (selectedYear === null) return [];
662
- return seasons.filter((s) => s.season_year === selectedYear).sort((a, b) => b.season_type - a.season_type).map((s) => ({ value: s.season_type, label: s.type_name }));
662
+ return seasons.filter((s) => s.year === selectedYear).sort((a, b) => a.type - b.type).map((s) => ({ value: s.type, label: s.type_name }));
663
663
  }
664
664
 
665
665
  // src/recentGamesSelection.ts
@@ -1356,6 +1356,17 @@ function buildRecentGameRows({
1356
1356
  };
1357
1357
  });
1358
1358
  }
1359
+
1360
+ // src/teamHeader.ts
1361
+ function getTeamInitials(team) {
1362
+ const words = team?.trim().split(/\s+/).filter(Boolean) ?? [];
1363
+ if (words.length === 0) return "T";
1364
+ return words.length > 1 ? words[0][0] + words[1][0] : words[0].substring(0, 2);
1365
+ }
1366
+ function getTeamConferenceInfo(conference, division) {
1367
+ if (!conference && !division) return "Conference - Division";
1368
+ return `${conference || ""} ${division || ""}`.trim();
1369
+ }
1359
1370
  export {
1360
1371
  BASEBALL_TEAM_STAT_IDS,
1361
1372
  BASKETBALL_TEAM_STAT_IDS,
@@ -1403,8 +1414,10 @@ export {
1403
1414
  getSeasonTypeOptions,
1404
1415
  getSeasonYearOptions,
1405
1416
  getStatRankingFootnotes,
1417
+ getTeamConferenceInfo,
1406
1418
  getTeamFacilityConfig,
1407
1419
  getTeamFactsConfig,
1420
+ getTeamInitials,
1408
1421
  getTeamPlaceSummaries,
1409
1422
  getTeamRankingConfigIds,
1410
1423
  getTeamStatColumns,