rategame-shared 1.1.476 → 1.1.477

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.
@@ -28,6 +28,11 @@ export declare const seasonsDocumentSchema: import("zod").ZodObject<{
28
28
  mls: import("zod").ZodBoolean;
29
29
  wnba: import("zod").ZodBoolean;
30
30
  cwc: import("zod").ZodBoolean;
31
+ laliga: import("zod").ZodBoolean;
32
+ seriea: import("zod").ZodBoolean;
33
+ bundesliga: import("zod").ZodBoolean;
34
+ ligue1: import("zod").ZodBoolean;
35
+ ucl: import("zod").ZodBoolean;
31
36
  }, "strip", import("zod").ZodTypeAny, {
32
37
  nba: boolean;
33
38
  nfl: boolean;
@@ -39,6 +44,11 @@ export declare const seasonsDocumentSchema: import("zod").ZodObject<{
39
44
  mls: boolean;
40
45
  wnba: boolean;
41
46
  cwc: boolean;
47
+ laliga: boolean;
48
+ seriea: boolean;
49
+ bundesliga: boolean;
50
+ ligue1: boolean;
51
+ ucl: boolean;
42
52
  }, {
43
53
  nba: boolean;
44
54
  nfl: boolean;
@@ -50,6 +60,11 @@ export declare const seasonsDocumentSchema: import("zod").ZodObject<{
50
60
  mls: boolean;
51
61
  wnba: boolean;
52
62
  cwc: boolean;
63
+ laliga: boolean;
64
+ seriea: boolean;
65
+ bundesliga: boolean;
66
+ ligue1: boolean;
67
+ ucl: boolean;
53
68
  }>;
54
69
  }, "strip", import("zod").ZodTypeAny, {
55
70
  leagues: {
@@ -63,6 +78,11 @@ export declare const seasonsDocumentSchema: import("zod").ZodObject<{
63
78
  mls: boolean;
64
79
  wnba: boolean;
65
80
  cwc: boolean;
81
+ laliga: boolean;
82
+ seriea: boolean;
83
+ bundesliga: boolean;
84
+ ligue1: boolean;
85
+ ucl: boolean;
66
86
  };
67
87
  id?: string | undefined;
68
88
  }, {
@@ -77,6 +97,11 @@ export declare const seasonsDocumentSchema: import("zod").ZodObject<{
77
97
  mls: boolean;
78
98
  wnba: boolean;
79
99
  cwc: boolean;
100
+ laliga: boolean;
101
+ seriea: boolean;
102
+ bundesliga: boolean;
103
+ ligue1: boolean;
104
+ ucl: boolean;
80
105
  };
81
106
  id?: string | undefined;
82
107
  }>;
@@ -27,6 +27,11 @@ exports.seasonsDocumentSchema = (0, zod_1.object)({
27
27
  mls: (0, zod_1.boolean)(),
28
28
  wnba: (0, zod_1.boolean)(),
29
29
  cwc: (0, zod_1.boolean)(),
30
+ laliga: (0, zod_1.boolean)(),
31
+ seriea: (0, zod_1.boolean)(),
32
+ bundesliga: (0, zod_1.boolean)(),
33
+ ligue1: (0, zod_1.boolean)(),
34
+ ucl: (0, zod_1.boolean)(),
30
35
  }),
31
36
  });
32
37
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rategame-shared",
3
- "version": "1.1.476",
3
+ "version": "1.1.477",
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;