rategame-shared 1.1.487 → 1.1.488

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.
@@ -44427,6 +44427,7 @@ export declare const searchGameSchema: z.ZodObject<{
44427
44427
  teamId: z.ZodOptional<z.ZodString>;
44428
44428
  round: z.ZodOptional<z.ZodString>;
44429
44429
  league: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
44430
+ leagues: z.ZodOptional<z.ZodString>;
44430
44431
  createdAt: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
44431
44432
  feedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
44432
44433
  sortBy: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating.avg:asc">, z.ZodLiteral<"rating.avg:desc">, z.ZodLiteral<"startedAt:asc">, z.ZodLiteral<"startedAt:desc">, z.ZodLiteral<"ratings.weightedRating.avg:asc">, z.ZodLiteral<"ratings.weightedRating.avg:desc">, z.ZodLiteral<"rating.votes.total:desc">]>>;
@@ -44452,6 +44453,7 @@ export declare const searchGameSchema: z.ZodObject<{
44452
44453
  q?: string | undefined;
44453
44454
  league?: string | undefined;
44454
44455
  createdAt?: "16hr" | "Today" | "Last 3 Days" | "This Week" | "This Season" | "This Month" | "This Year" | "2025" | "2024" | "All" | "All Time" | "12h" | "daily" | "weekly" | undefined;
44456
+ leagues?: string | undefined;
44455
44457
  limit?: string | undefined;
44456
44458
  customDateFrom?: string | undefined;
44457
44459
  customDateTo?: string | undefined;
@@ -44476,6 +44478,7 @@ export declare const searchGameSchema: z.ZodObject<{
44476
44478
  q?: string | undefined;
44477
44479
  league?: string | undefined;
44478
44480
  createdAt?: "16hr" | "Today" | "Last 3 Days" | "This Week" | "This Season" | "This Month" | "This Year" | "2025" | "2024" | "All" | "All Time" | "12h" | "daily" | "weekly" | undefined;
44481
+ leagues?: string | undefined;
44479
44482
  limit?: string | undefined;
44480
44483
  customDateFrom?: string | undefined;
44481
44484
  customDateTo?: string | undefined;
@@ -343,6 +343,7 @@ exports.searchGameSchema = zod_1.z.object({
343
343
  teamId: zod_1.z.string().optional(),
344
344
  round: zod_1.z.string().optional(),
345
345
  league: sharedTypes_1.leagueSlug.or((0, zod_1.string)()).optional(),
346
+ leagues: zod_1.z.string().optional(),
346
347
  createdAt: sharedTypes_1.timeFilterSchema.optional(),
347
348
  feedType: zod_1.z.union([zod_1.z.literal("newest"), zod_1.z.literal("forYou")]).optional(),
348
349
  sortBy: zod_1.z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rategame-shared",
3
- "version": "1.1.487",
3
+ "version": "1.1.488",
4
4
  "description": "This package contains shared resources for the Rate Game project.",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1,5 +0,0 @@
1
- export declare const FANCY_TEXT_ERROR_MESSAGE = "Fancy or styled characters are not allowed. Please use normal letters and numbers.";
2
- /**
3
- * Detects mathematical-alphanumeric, fullwidth, and similar disguised characters.
4
- */
5
- export declare function containsFancyText(value: string | null | undefined): boolean;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.containsFancyText = exports.FANCY_TEXT_ERROR_MESSAGE = void 0;
4
- exports.FANCY_TEXT_ERROR_MESSAGE = 'Fancy or styled characters are not allowed. Please use normal letters and numbers.';
5
- /** Unicode ranges used for disguised / styled text (not normal user input). */
6
- const FANCY_CODE_POINT_RANGES = [
7
- [0x1d400, 0x1d7ff],
8
- [0x1d800, 0x1daff],
9
- [0x1f100, 0x1f1ff],
10
- [0x2100, 0x214f],
11
- [0x2460, 0x24ff],
12
- [0xff01, 0xff5e], // Fullwidth ASCII variants
13
- ];
14
- const isFancyCodePoint = (code) => FANCY_CODE_POINT_RANGES.some(([start, end]) => code >= start && code <= end);
15
- /**
16
- * Detects mathematical-alphanumeric, fullwidth, and similar disguised characters.
17
- */
18
- function containsFancyText(value) {
19
- if (!value)
20
- return false;
21
- for (const char of value) {
22
- const code = char.codePointAt(0);
23
- if (code !== undefined && isFancyCodePoint(code)) {
24
- return true;
25
- }
26
- }
27
- return false;
28
- }
29
- exports.containsFancyText = containsFancyText;
@@ -1,26 +0,0 @@
1
- export declare const DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER: readonly ["nba", "mlb", "wbc", "nfl", "nhl", "iho", "epl", "fifa", "cbb", "cfb", "mls", "wnba", "cwc"];
2
- export type FavoriteTeamLookup = {
3
- id?: string | number;
4
- name?: string;
5
- image?: string;
6
- primaryColor?: string | null;
7
- countryId?: string | number;
8
- };
9
- export type FavoriteTeamChip = {
10
- key: string;
11
- league: string;
12
- teamImage: string;
13
- teamId: string;
14
- teamName: string;
15
- primaryColor: string | null;
16
- countryId?: string;
17
- };
18
- export declare function getFavoriteTeamChipKey({ league, teamId, countryId, }: {
19
- league: string;
20
- teamId: string;
21
- countryId?: string;
22
- }): string;
23
- export declare function buildFavoriteTeamChips(favoriteTeamsPerLeague: Record<string, string> | undefined, allTeams: Record<string, FavoriteTeamLookup[] | undefined> | undefined): FavoriteTeamChip[];
24
- export declare function sortFavoriteTeamChips(chips: FavoriteTeamChip[], favoriteTeamsOrder?: string[]): FavoriteTeamChip[];
25
- export declare function buildFavoriteTeamsOrderFromChips(chips: FavoriteTeamChip[]): string[];
26
- export declare function syncFavoriteTeamsOrder(favoriteTeamsOrder: string[] | undefined, chips: FavoriteTeamChip[]): string[];
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syncFavoriteTeamsOrder = exports.buildFavoriteTeamsOrderFromChips = exports.sortFavoriteTeamChips = exports.buildFavoriteTeamChips = exports.getFavoriteTeamChipKey = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER = void 0;
4
- exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER = [
5
- "nba",
6
- "mlb",
7
- "wbc",
8
- "nfl",
9
- "nhl",
10
- "iho",
11
- "epl",
12
- "fifa",
13
- "cbb",
14
- "cfb",
15
- "mls",
16
- "wnba",
17
- "cwc",
18
- ];
19
- function getFavoriteTeamChipKey({ league, teamId, countryId, }) {
20
- return countryId ? `country-${countryId}` : `${league}-${teamId}`;
21
- }
22
- exports.getFavoriteTeamChipKey = getFavoriteTeamChipKey;
23
- function buildFavoriteTeamChips(favoriteTeamsPerLeague, allTeams) {
24
- if (!favoriteTeamsPerLeague)
25
- return [];
26
- const chipsByKey = new Map();
27
- Object.entries(favoriteTeamsPerLeague).forEach(([league, teamId]) => {
28
- var _a, _b, _c;
29
- const leagueKey = league === "ncaa" ? "cbb" : league;
30
- const favoriteTeam = (_a = allTeams === null || allTeams === void 0 ? void 0 : allTeams[leagueKey]) === null || _a === void 0 ? void 0 : _a.find(item => { var _a; return ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.toString()) === teamId; });
31
- if (!(favoriteTeam === null || favoriteTeam === void 0 ? void 0 : favoriteTeam.image))
32
- return;
33
- const countryId = favoriteTeam.countryId
34
- ? String(favoriteTeam.countryId)
35
- : undefined;
36
- const key = getFavoriteTeamChipKey({
37
- league: leagueKey,
38
- teamId,
39
- countryId,
40
- });
41
- if (chipsByKey.has(key))
42
- return;
43
- chipsByKey.set(key, {
44
- key,
45
- league: leagueKey,
46
- teamImage: favoriteTeam.image,
47
- teamId,
48
- teamName: (_b = favoriteTeam.name) !== null && _b !== void 0 ? _b : "",
49
- primaryColor: (_c = favoriteTeam.primaryColor) !== null && _c !== void 0 ? _c : null,
50
- countryId,
51
- });
52
- });
53
- return Array.from(chipsByKey.values());
54
- }
55
- exports.buildFavoriteTeamChips = buildFavoriteTeamChips;
56
- function sortFavoriteTeamChips(chips, favoriteTeamsOrder) {
57
- if (!chips.length)
58
- return chips;
59
- const orderIndex = new Map((favoriteTeamsOrder !== null && favoriteTeamsOrder !== void 0 ? favoriteTeamsOrder : []).map((key, index) => [key, index]));
60
- return [...chips].sort((a, b) => {
61
- const aOrder = orderIndex.get(a.key);
62
- const bOrder = orderIndex.get(b.key);
63
- if (aOrder !== undefined && bOrder !== undefined) {
64
- return aOrder - bOrder;
65
- }
66
- if (aOrder !== undefined)
67
- return -1;
68
- if (bOrder !== undefined)
69
- return 1;
70
- const aIndex = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.indexOf(a.league);
71
- const bIndex = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.indexOf(b.league);
72
- return ((aIndex === -1 ? exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.length : aIndex) -
73
- (bIndex === -1 ? exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.length : bIndex));
74
- });
75
- }
76
- exports.sortFavoriteTeamChips = sortFavoriteTeamChips;
77
- function buildFavoriteTeamsOrderFromChips(chips) {
78
- return sortFavoriteTeamChips(chips).map(chip => chip.key);
79
- }
80
- exports.buildFavoriteTeamsOrderFromChips = buildFavoriteTeamsOrderFromChips;
81
- function syncFavoriteTeamsOrder(favoriteTeamsOrder, chips) {
82
- const chipKeys = new Set(chips.map(chip => chip.key));
83
- const syncedOrder = (favoriteTeamsOrder !== null && favoriteTeamsOrder !== void 0 ? favoriteTeamsOrder : []).filter(key => chipKeys.has(key));
84
- chips.forEach(chip => {
85
- if (!syncedOrder.includes(chip.key)) {
86
- syncedOrder.push(chip.key);
87
- }
88
- });
89
- return syncedOrder;
90
- }
91
- exports.syncFavoriteTeamsOrder = syncFavoriteTeamsOrder;