rategame-shared 1.1.243 → 1.1.245

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.
@@ -0,0 +1 @@
1
+ export * from "./leagueSupport";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./leagueSupport"), exports);
@@ -0,0 +1,158 @@
1
+ import { z } from "zod";
2
+ import { leagueSlug } from "../schemas/sharedTypes";
3
+ export type LeagueSlug = z.infer<typeof leagueSlug>;
4
+ /**
5
+ * Leagues that support player voting functionality
6
+ */
7
+ export declare const SUPPORTED_LEAGUES: LeagueSlug[];
8
+ /**
9
+ * Leagues that do not support player voting functionality
10
+ */
11
+ export declare const UNSUPPORTED_LEAGUES: LeagueSlug[];
12
+ /**
13
+ * Configuration object for league-specific settings
14
+ */
15
+ export declare const LEAGUE_CONFIG: {
16
+ readonly nfl: {
17
+ readonly playersPath: "leagues/nfl/teams";
18
+ readonly votingEnabled: true;
19
+ readonly displayName: "NFL";
20
+ };
21
+ readonly nba: {
22
+ readonly playersPath: "leagues/nba/teams";
23
+ readonly votingEnabled: true;
24
+ readonly displayName: "NBA";
25
+ };
26
+ readonly nhl: {
27
+ readonly playersPath: "leagues/nhl/teams";
28
+ readonly votingEnabled: true;
29
+ readonly displayName: "NHL";
30
+ };
31
+ readonly mlb: {
32
+ readonly playersPath: "leagues/mlb/teams";
33
+ readonly votingEnabled: true;
34
+ readonly displayName: "MLB";
35
+ };
36
+ readonly mls: {
37
+ readonly playersPath: "leagues/mls/teams";
38
+ readonly votingEnabled: true;
39
+ readonly displayName: "MLS";
40
+ };
41
+ readonly epl: {
42
+ readonly playersPath: "leagues/epl/teams";
43
+ readonly votingEnabled: true;
44
+ readonly displayName: "EPL";
45
+ };
46
+ readonly cwc: {
47
+ readonly playersPath: "leagues/cwc/teams";
48
+ readonly votingEnabled: false;
49
+ readonly displayName: "Cricket World Cup";
50
+ };
51
+ readonly cbb: {
52
+ readonly playersPath: "leagues/cbb/teams";
53
+ readonly votingEnabled: false;
54
+ readonly displayName: "College Basketball";
55
+ };
56
+ readonly ncaa: {
57
+ readonly playersPath: "leagues/ncaa/teams";
58
+ readonly votingEnabled: false;
59
+ readonly displayName: "NCAA";
60
+ };
61
+ readonly cfb: {
62
+ readonly playersPath: "leagues/cfb/teams";
63
+ readonly votingEnabled: false;
64
+ readonly displayName: "College Football";
65
+ };
66
+ readonly wnba: {
67
+ readonly playersPath: "leagues/wnba/teams";
68
+ readonly votingEnabled: false;
69
+ readonly displayName: "WNBA";
70
+ };
71
+ readonly global: {
72
+ readonly playersPath: "";
73
+ readonly votingEnabled: false;
74
+ readonly displayName: "Global";
75
+ };
76
+ };
77
+ /**
78
+ * Check if a league supports player voting
79
+ * @param league - The league to check
80
+ * @returns true if the league supports player voting, false otherwise
81
+ */
82
+ export declare const isLeagueSupported: (league: LeagueSlug) => boolean;
83
+ /**
84
+ * Validate league support and throw error if unsupported
85
+ * @param league - The league to validate
86
+ * @throws Error if league is not supported for voting
87
+ */
88
+ export declare const validateLeagueSupport: (league: LeagueSlug) => void;
89
+ /**
90
+ * Get league configuration
91
+ * @param league - The league to get configuration for
92
+ * @returns League configuration object
93
+ */
94
+ export declare const getLeagueConfig: (league: LeagueSlug) => {
95
+ readonly playersPath: "leagues/nfl/teams";
96
+ readonly votingEnabled: true;
97
+ readonly displayName: "NFL";
98
+ } | {
99
+ readonly playersPath: "leagues/nba/teams";
100
+ readonly votingEnabled: true;
101
+ readonly displayName: "NBA";
102
+ } | {
103
+ readonly playersPath: "leagues/nhl/teams";
104
+ readonly votingEnabled: true;
105
+ readonly displayName: "NHL";
106
+ } | {
107
+ readonly playersPath: "leagues/mlb/teams";
108
+ readonly votingEnabled: true;
109
+ readonly displayName: "MLB";
110
+ } | {
111
+ readonly playersPath: "leagues/mls/teams";
112
+ readonly votingEnabled: true;
113
+ readonly displayName: "MLS";
114
+ } | {
115
+ readonly playersPath: "leagues/epl/teams";
116
+ readonly votingEnabled: true;
117
+ readonly displayName: "EPL";
118
+ } | {
119
+ readonly playersPath: "leagues/cwc/teams";
120
+ readonly votingEnabled: false;
121
+ readonly displayName: "Cricket World Cup";
122
+ } | {
123
+ readonly playersPath: "leagues/cbb/teams";
124
+ readonly votingEnabled: false;
125
+ readonly displayName: "College Basketball";
126
+ } | {
127
+ readonly playersPath: "leagues/ncaa/teams";
128
+ readonly votingEnabled: false;
129
+ readonly displayName: "NCAA";
130
+ } | {
131
+ readonly playersPath: "leagues/cfb/teams";
132
+ readonly votingEnabled: false;
133
+ readonly displayName: "College Football";
134
+ } | {
135
+ readonly playersPath: "leagues/wnba/teams";
136
+ readonly votingEnabled: false;
137
+ readonly displayName: "WNBA";
138
+ } | {
139
+ readonly playersPath: "";
140
+ readonly votingEnabled: false;
141
+ readonly displayName: "Global";
142
+ };
143
+ /**
144
+ * Get all supported leagues
145
+ * @returns Array of supported league slugs
146
+ */
147
+ export declare const getSupportedLeagues: () => LeagueSlug[];
148
+ /**
149
+ * Get all unsupported leagues
150
+ * @returns Array of unsupported league slugs
151
+ */
152
+ export declare const getUnsupportedLeagues: () => LeagueSlug[];
153
+ /**
154
+ * Check if league exists in the system
155
+ * @param league - The league to check
156
+ * @returns true if league exists, false otherwise
157
+ */
158
+ export declare const isValidLeague: (league: string) => league is "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidLeague = exports.getUnsupportedLeagues = exports.getSupportedLeagues = exports.getLeagueConfig = exports.validateLeagueSupport = exports.isLeagueSupported = exports.LEAGUE_CONFIG = exports.UNSUPPORTED_LEAGUES = exports.SUPPORTED_LEAGUES = void 0;
4
+ /**
5
+ * Leagues that support player voting functionality
6
+ */
7
+ exports.SUPPORTED_LEAGUES = [
8
+ "nfl",
9
+ "nba",
10
+ "nhl",
11
+ "mlb",
12
+ "mls",
13
+ "epl",
14
+ ];
15
+ /**
16
+ * Leagues that do not support player voting functionality
17
+ */
18
+ exports.UNSUPPORTED_LEAGUES = [
19
+ "cwc",
20
+ "cbb",
21
+ "ncaa",
22
+ "cfb",
23
+ "wnba",
24
+ ];
25
+ /**
26
+ * Configuration object for league-specific settings
27
+ */
28
+ exports.LEAGUE_CONFIG = {
29
+ nfl: {
30
+ playersPath: "leagues/nfl/teams",
31
+ votingEnabled: true,
32
+ displayName: "NFL",
33
+ },
34
+ nba: {
35
+ playersPath: "leagues/nba/teams",
36
+ votingEnabled: true,
37
+ displayName: "NBA",
38
+ },
39
+ nhl: {
40
+ playersPath: "leagues/nhl/teams",
41
+ votingEnabled: true,
42
+ displayName: "NHL",
43
+ },
44
+ mlb: {
45
+ playersPath: "leagues/mlb/teams",
46
+ votingEnabled: true,
47
+ displayName: "MLB",
48
+ },
49
+ mls: {
50
+ playersPath: "leagues/mls/teams",
51
+ votingEnabled: true,
52
+ displayName: "MLS",
53
+ },
54
+ epl: {
55
+ playersPath: "leagues/epl/teams",
56
+ votingEnabled: true,
57
+ displayName: "EPL",
58
+ },
59
+ cwc: {
60
+ playersPath: "leagues/cwc/teams",
61
+ votingEnabled: false,
62
+ displayName: "Cricket World Cup",
63
+ },
64
+ cbb: {
65
+ playersPath: "leagues/cbb/teams",
66
+ votingEnabled: false,
67
+ displayName: "College Basketball",
68
+ },
69
+ ncaa: {
70
+ playersPath: "leagues/ncaa/teams",
71
+ votingEnabled: false,
72
+ displayName: "NCAA",
73
+ },
74
+ cfb: {
75
+ playersPath: "leagues/cfb/teams",
76
+ votingEnabled: false,
77
+ displayName: "College Football",
78
+ },
79
+ wnba: {
80
+ playersPath: "leagues/wnba/teams",
81
+ votingEnabled: false,
82
+ displayName: "WNBA",
83
+ },
84
+ global: {
85
+ playersPath: "",
86
+ votingEnabled: false,
87
+ displayName: "Global",
88
+ },
89
+ };
90
+ /**
91
+ * Check if a league supports player voting
92
+ * @param league - The league to check
93
+ * @returns true if the league supports player voting, false otherwise
94
+ */
95
+ const isLeagueSupported = (league) => {
96
+ return exports.SUPPORTED_LEAGUES.includes(league);
97
+ };
98
+ exports.isLeagueSupported = isLeagueSupported;
99
+ /**
100
+ * Validate league support and throw error if unsupported
101
+ * @param league - The league to validate
102
+ * @throws Error if league is not supported for voting
103
+ */
104
+ const validateLeagueSupport = (league) => {
105
+ if (!(0, exports.isLeagueSupported)(league)) {
106
+ throw new Error(`League ${league} does not support player voting`);
107
+ }
108
+ };
109
+ exports.validateLeagueSupport = validateLeagueSupport;
110
+ /**
111
+ * Get league configuration
112
+ * @param league - The league to get configuration for
113
+ * @returns League configuration object
114
+ */
115
+ const getLeagueConfig = (league) => {
116
+ return exports.LEAGUE_CONFIG[league];
117
+ };
118
+ exports.getLeagueConfig = getLeagueConfig;
119
+ /**
120
+ * Get all supported leagues
121
+ * @returns Array of supported league slugs
122
+ */
123
+ const getSupportedLeagues = () => {
124
+ return [...exports.SUPPORTED_LEAGUES];
125
+ };
126
+ exports.getSupportedLeagues = getSupportedLeagues;
127
+ /**
128
+ * Get all unsupported leagues
129
+ * @returns Array of unsupported league slugs
130
+ */
131
+ const getUnsupportedLeagues = () => {
132
+ return [...exports.UNSUPPORTED_LEAGUES];
133
+ };
134
+ exports.getUnsupportedLeagues = getUnsupportedLeagues;
135
+ /**
136
+ * Check if league exists in the system
137
+ * @param league - The league to check
138
+ * @returns true if league exists, false otherwise
139
+ */
140
+ const isValidLeague = (league) => {
141
+ return Object.keys(exports.LEAGUE_CONFIG).includes(league);
142
+ };
143
+ exports.isValidLeague = isValidLeague;
package/dist/index.d.ts CHANGED
@@ -23,3 +23,4 @@ export * from "./models/userEvent";
23
23
  export * from "./helpers/index";
24
24
  export * from "./models/player";
25
25
  export * from "./models/voting";
26
+ export * from "./constants";
package/dist/index.js CHANGED
@@ -39,3 +39,4 @@ __exportStar(require("./models/userEvent"), exports);
39
39
  __exportStar(require("./helpers/index"), exports);
40
40
  __exportStar(require("./models/player"), exports);
41
41
  __exportStar(require("./models/voting"), exports);
42
+ __exportStar(require("./constants"), exports);
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { playerVoteSchema, voteSubmissionDtoSchema, voteSubmissionResponseDtoSchema, mostVotedPlayerSchema, gameVoteResultsSchema, teamPlayersResponseDtoSchema, gamePlayersResponseDtoSchema, userVoteResponseDtoSchema, voteResultsResponseDtoSchema } from "../schemas/voting";
2
+ import { playerVoteSchema, voteSubmissionDtoSchema, voteSubmissionResponseDtoSchema, mostVotedPlayerSchema, gameVoteResultsSchema, teamPlayersResponseDtoSchema, gamePlayersResponseDtoSchema, userVoteResponseDtoSchema, voteResultsResponseDtoSchema, leagueSupportErrorSchema, apiErrorResponseSchema, playerWithVotesSchema } from "../schemas/voting";
3
3
  export type PlayerVote = z.infer<typeof playerVoteSchema>;
4
4
  export type VoteSubmissionDto = z.infer<typeof voteSubmissionDtoSchema>;
5
5
  export type VoteSubmissionResponseDto = z.infer<typeof voteSubmissionResponseDtoSchema>;
@@ -9,3 +9,6 @@ export type TeamPlayersResponseDto = z.infer<typeof teamPlayersResponseDtoSchema
9
9
  export type GamePlayersResponseDto = z.infer<typeof gamePlayersResponseDtoSchema>;
10
10
  export type UserVoteResponseDto = z.infer<typeof userVoteResponseDtoSchema>;
11
11
  export type VoteResultsResponseDto = z.infer<typeof voteResultsResponseDtoSchema>;
12
+ export type LeagueSupportError = z.infer<typeof leagueSupportErrorSchema>;
13
+ export type ApiErrorResponse = z.infer<typeof apiErrorResponseSchema>;
14
+ export type PlayerWithVotes = z.infer<typeof playerWithVotesSchema>;
@@ -2216,127 +2216,257 @@ export declare const teamPlayersResponseDtoSchema: z.ZodObject<{
2216
2216
  id?: string | undefined;
2217
2217
  }[];
2218
2218
  }>;
2219
+ export declare const playerWithVotesSchema: z.ZodObject<{
2220
+ player: z.ZodObject<{
2221
+ id: z.ZodOptional<z.ZodString>;
2222
+ firstName: z.ZodString;
2223
+ lastName: z.ZodString;
2224
+ shortName: z.ZodString;
2225
+ position: z.ZodString;
2226
+ positionCategory: z.ZodString;
2227
+ jerseyNumber: z.ZodNumber;
2228
+ teamId: z.ZodNumber;
2229
+ leagueId: 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<"global">]>;
2230
+ }, "strip", z.ZodTypeAny, {
2231
+ position: string;
2232
+ teamId: number;
2233
+ firstName: string;
2234
+ lastName: string;
2235
+ shortName: string;
2236
+ positionCategory: string;
2237
+ jerseyNumber: number;
2238
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2239
+ id?: string | undefined;
2240
+ }, {
2241
+ position: string;
2242
+ teamId: number;
2243
+ firstName: string;
2244
+ lastName: string;
2245
+ shortName: string;
2246
+ positionCategory: string;
2247
+ jerseyNumber: number;
2248
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2249
+ id?: string | undefined;
2250
+ }>;
2251
+ votes: z.ZodNumber;
2252
+ }, "strip", z.ZodTypeAny, {
2253
+ votes: number;
2254
+ player: {
2255
+ position: string;
2256
+ teamId: number;
2257
+ firstName: string;
2258
+ lastName: string;
2259
+ shortName: string;
2260
+ positionCategory: string;
2261
+ jerseyNumber: number;
2262
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2263
+ id?: string | undefined;
2264
+ };
2265
+ }, {
2266
+ votes: number;
2267
+ player: {
2268
+ position: string;
2269
+ teamId: number;
2270
+ firstName: string;
2271
+ lastName: string;
2272
+ shortName: string;
2273
+ positionCategory: string;
2274
+ jerseyNumber: number;
2275
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2276
+ id?: string | undefined;
2277
+ };
2278
+ }>;
2219
2279
  export declare const gamePlayersResponseDtoSchema: z.ZodObject<{
2220
2280
  gameId: z.ZodString;
2221
2281
  league: 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<"global">]>;
2222
2282
  homeTeam: z.ZodObject<{
2223
2283
  teamId: z.ZodString;
2224
2284
  players: z.ZodArray<z.ZodObject<{
2225
- id: z.ZodOptional<z.ZodString>;
2226
- firstName: z.ZodString;
2227
- lastName: z.ZodString;
2228
- shortName: z.ZodString;
2229
- position: z.ZodString;
2230
- positionCategory: z.ZodString;
2231
- jerseyNumber: z.ZodNumber;
2232
- teamId: z.ZodNumber;
2233
- leagueId: 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<"global">]>;
2285
+ player: z.ZodObject<{
2286
+ id: z.ZodOptional<z.ZodString>;
2287
+ firstName: z.ZodString;
2288
+ lastName: z.ZodString;
2289
+ shortName: z.ZodString;
2290
+ position: z.ZodString;
2291
+ positionCategory: z.ZodString;
2292
+ jerseyNumber: z.ZodNumber;
2293
+ teamId: z.ZodNumber;
2294
+ leagueId: 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<"global">]>;
2295
+ }, "strip", z.ZodTypeAny, {
2296
+ position: string;
2297
+ teamId: number;
2298
+ firstName: string;
2299
+ lastName: string;
2300
+ shortName: string;
2301
+ positionCategory: string;
2302
+ jerseyNumber: number;
2303
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2304
+ id?: string | undefined;
2305
+ }, {
2306
+ position: string;
2307
+ teamId: number;
2308
+ firstName: string;
2309
+ lastName: string;
2310
+ shortName: string;
2311
+ positionCategory: string;
2312
+ jerseyNumber: number;
2313
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2314
+ id?: string | undefined;
2315
+ }>;
2316
+ votes: z.ZodNumber;
2234
2317
  }, "strip", z.ZodTypeAny, {
2235
- position: string;
2236
- teamId: number;
2237
- firstName: string;
2238
- lastName: string;
2239
- shortName: string;
2240
- positionCategory: string;
2241
- jerseyNumber: number;
2242
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2243
- id?: string | undefined;
2318
+ votes: number;
2319
+ player: {
2320
+ position: string;
2321
+ teamId: number;
2322
+ firstName: string;
2323
+ lastName: string;
2324
+ shortName: string;
2325
+ positionCategory: string;
2326
+ jerseyNumber: number;
2327
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2328
+ id?: string | undefined;
2329
+ };
2244
2330
  }, {
2245
- position: string;
2246
- teamId: number;
2247
- firstName: string;
2248
- lastName: string;
2249
- shortName: string;
2250
- positionCategory: string;
2251
- jerseyNumber: number;
2252
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2253
- id?: string | undefined;
2331
+ votes: number;
2332
+ player: {
2333
+ position: string;
2334
+ teamId: number;
2335
+ firstName: string;
2336
+ lastName: string;
2337
+ shortName: string;
2338
+ positionCategory: string;
2339
+ jerseyNumber: number;
2340
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2341
+ id?: string | undefined;
2342
+ };
2254
2343
  }>, "many">;
2255
2344
  }, "strip", z.ZodTypeAny, {
2256
2345
  teamId: string;
2257
2346
  players: {
2258
- position: string;
2259
- teamId: number;
2260
- firstName: string;
2261
- lastName: string;
2262
- shortName: string;
2263
- positionCategory: string;
2264
- jerseyNumber: number;
2265
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2266
- id?: string | undefined;
2347
+ votes: number;
2348
+ player: {
2349
+ position: string;
2350
+ teamId: number;
2351
+ firstName: string;
2352
+ lastName: string;
2353
+ shortName: string;
2354
+ positionCategory: string;
2355
+ jerseyNumber: number;
2356
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2357
+ id?: string | undefined;
2358
+ };
2267
2359
  }[];
2268
2360
  }, {
2269
2361
  teamId: string;
2270
2362
  players: {
2271
- position: string;
2272
- teamId: number;
2273
- firstName: string;
2274
- lastName: string;
2275
- shortName: string;
2276
- positionCategory: string;
2277
- jerseyNumber: number;
2278
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2279
- id?: string | undefined;
2363
+ votes: number;
2364
+ player: {
2365
+ position: string;
2366
+ teamId: number;
2367
+ firstName: string;
2368
+ lastName: string;
2369
+ shortName: string;
2370
+ positionCategory: string;
2371
+ jerseyNumber: number;
2372
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2373
+ id?: string | undefined;
2374
+ };
2280
2375
  }[];
2281
2376
  }>;
2282
2377
  awayTeam: z.ZodObject<{
2283
2378
  teamId: z.ZodString;
2284
2379
  players: z.ZodArray<z.ZodObject<{
2285
- id: z.ZodOptional<z.ZodString>;
2286
- firstName: z.ZodString;
2287
- lastName: z.ZodString;
2288
- shortName: z.ZodString;
2289
- position: z.ZodString;
2290
- positionCategory: z.ZodString;
2291
- jerseyNumber: z.ZodNumber;
2292
- teamId: z.ZodNumber;
2293
- leagueId: 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<"global">]>;
2380
+ player: z.ZodObject<{
2381
+ id: z.ZodOptional<z.ZodString>;
2382
+ firstName: z.ZodString;
2383
+ lastName: z.ZodString;
2384
+ shortName: z.ZodString;
2385
+ position: z.ZodString;
2386
+ positionCategory: z.ZodString;
2387
+ jerseyNumber: z.ZodNumber;
2388
+ teamId: z.ZodNumber;
2389
+ leagueId: 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<"global">]>;
2390
+ }, "strip", z.ZodTypeAny, {
2391
+ position: string;
2392
+ teamId: number;
2393
+ firstName: string;
2394
+ lastName: string;
2395
+ shortName: string;
2396
+ positionCategory: string;
2397
+ jerseyNumber: number;
2398
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2399
+ id?: string | undefined;
2400
+ }, {
2401
+ position: string;
2402
+ teamId: number;
2403
+ firstName: string;
2404
+ lastName: string;
2405
+ shortName: string;
2406
+ positionCategory: string;
2407
+ jerseyNumber: number;
2408
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2409
+ id?: string | undefined;
2410
+ }>;
2411
+ votes: z.ZodNumber;
2294
2412
  }, "strip", z.ZodTypeAny, {
2295
- position: string;
2296
- teamId: number;
2297
- firstName: string;
2298
- lastName: string;
2299
- shortName: string;
2300
- positionCategory: string;
2301
- jerseyNumber: number;
2302
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2303
- id?: string | undefined;
2413
+ votes: number;
2414
+ player: {
2415
+ position: string;
2416
+ teamId: number;
2417
+ firstName: string;
2418
+ lastName: string;
2419
+ shortName: string;
2420
+ positionCategory: string;
2421
+ jerseyNumber: number;
2422
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2423
+ id?: string | undefined;
2424
+ };
2304
2425
  }, {
2305
- position: string;
2306
- teamId: number;
2307
- firstName: string;
2308
- lastName: string;
2309
- shortName: string;
2310
- positionCategory: string;
2311
- jerseyNumber: number;
2312
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2313
- id?: string | undefined;
2426
+ votes: number;
2427
+ player: {
2428
+ position: string;
2429
+ teamId: number;
2430
+ firstName: string;
2431
+ lastName: string;
2432
+ shortName: string;
2433
+ positionCategory: string;
2434
+ jerseyNumber: number;
2435
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2436
+ id?: string | undefined;
2437
+ };
2314
2438
  }>, "many">;
2315
2439
  }, "strip", z.ZodTypeAny, {
2316
2440
  teamId: string;
2317
2441
  players: {
2318
- position: string;
2319
- teamId: number;
2320
- firstName: string;
2321
- lastName: string;
2322
- shortName: string;
2323
- positionCategory: string;
2324
- jerseyNumber: number;
2325
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2326
- id?: string | undefined;
2442
+ votes: number;
2443
+ player: {
2444
+ position: string;
2445
+ teamId: number;
2446
+ firstName: string;
2447
+ lastName: string;
2448
+ shortName: string;
2449
+ positionCategory: string;
2450
+ jerseyNumber: number;
2451
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2452
+ id?: string | undefined;
2453
+ };
2327
2454
  }[];
2328
2455
  }, {
2329
2456
  teamId: string;
2330
2457
  players: {
2331
- position: string;
2332
- teamId: number;
2333
- firstName: string;
2334
- lastName: string;
2335
- shortName: string;
2336
- positionCategory: string;
2337
- jerseyNumber: number;
2338
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2339
- id?: string | undefined;
2458
+ votes: number;
2459
+ player: {
2460
+ position: string;
2461
+ teamId: number;
2462
+ firstName: string;
2463
+ lastName: string;
2464
+ shortName: string;
2465
+ positionCategory: string;
2466
+ jerseyNumber: number;
2467
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2468
+ id?: string | undefined;
2469
+ };
2340
2470
  }[];
2341
2471
  }>;
2342
2472
  }, "strip", z.ZodTypeAny, {
@@ -2344,29 +2474,35 @@ export declare const gamePlayersResponseDtoSchema: z.ZodObject<{
2344
2474
  homeTeam: {
2345
2475
  teamId: string;
2346
2476
  players: {
2347
- position: string;
2348
- teamId: number;
2349
- firstName: string;
2350
- lastName: string;
2351
- shortName: string;
2352
- positionCategory: string;
2353
- jerseyNumber: number;
2354
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2355
- id?: string | undefined;
2477
+ votes: number;
2478
+ player: {
2479
+ position: string;
2480
+ teamId: number;
2481
+ firstName: string;
2482
+ lastName: string;
2483
+ shortName: string;
2484
+ positionCategory: string;
2485
+ jerseyNumber: number;
2486
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2487
+ id?: string | undefined;
2488
+ };
2356
2489
  }[];
2357
2490
  };
2358
2491
  awayTeam: {
2359
2492
  teamId: string;
2360
2493
  players: {
2361
- position: string;
2362
- teamId: number;
2363
- firstName: string;
2364
- lastName: string;
2365
- shortName: string;
2366
- positionCategory: string;
2367
- jerseyNumber: number;
2368
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2369
- id?: string | undefined;
2494
+ votes: number;
2495
+ player: {
2496
+ position: string;
2497
+ teamId: number;
2498
+ firstName: string;
2499
+ lastName: string;
2500
+ shortName: string;
2501
+ positionCategory: string;
2502
+ jerseyNumber: number;
2503
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2504
+ id?: string | undefined;
2505
+ };
2370
2506
  }[];
2371
2507
  };
2372
2508
  gameId: string;
@@ -2375,29 +2511,35 @@ export declare const gamePlayersResponseDtoSchema: z.ZodObject<{
2375
2511
  homeTeam: {
2376
2512
  teamId: string;
2377
2513
  players: {
2378
- position: string;
2379
- teamId: number;
2380
- firstName: string;
2381
- lastName: string;
2382
- shortName: string;
2383
- positionCategory: string;
2384
- jerseyNumber: number;
2385
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2386
- id?: string | undefined;
2514
+ votes: number;
2515
+ player: {
2516
+ position: string;
2517
+ teamId: number;
2518
+ firstName: string;
2519
+ lastName: string;
2520
+ shortName: string;
2521
+ positionCategory: string;
2522
+ jerseyNumber: number;
2523
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2524
+ id?: string | undefined;
2525
+ };
2387
2526
  }[];
2388
2527
  };
2389
2528
  awayTeam: {
2390
2529
  teamId: string;
2391
2530
  players: {
2392
- position: string;
2393
- teamId: number;
2394
- firstName: string;
2395
- lastName: string;
2396
- shortName: string;
2397
- positionCategory: string;
2398
- jerseyNumber: number;
2399
- leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2400
- id?: string | undefined;
2531
+ votes: number;
2532
+ player: {
2533
+ position: string;
2534
+ teamId: number;
2535
+ firstName: string;
2536
+ lastName: string;
2537
+ shortName: string;
2538
+ positionCategory: string;
2539
+ jerseyNumber: number;
2540
+ leagueId: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
2541
+ id?: string | undefined;
2542
+ };
2401
2543
  }[];
2402
2544
  };
2403
2545
  gameId: string;
@@ -3590,3 +3732,38 @@ export declare const voteResultsResponseDtoSchema: z.ZodObject<{
3590
3732
  } | null;
3591
3733
  };
3592
3734
  }>;
3735
+ export declare const leagueSupportErrorSchema: z.ZodObject<{
3736
+ statusCode: z.ZodNumber;
3737
+ message: z.ZodString;
3738
+ error: z.ZodString;
3739
+ league: 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<"global">]>;
3740
+ supportedLeagues: z.ZodArray<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<"global">]>, "many">;
3741
+ }, "strip", z.ZodTypeAny, {
3742
+ error: string;
3743
+ message: string;
3744
+ statusCode: number;
3745
+ league: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
3746
+ supportedLeagues: ("global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc")[];
3747
+ }, {
3748
+ error: string;
3749
+ message: string;
3750
+ statusCode: number;
3751
+ league: "global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc";
3752
+ supportedLeagues: ("global" | "nba" | "ncaa" | "nfl" | "nhl" | "mlb" | "cbb" | "cfb" | "epl" | "mls" | "wnba" | "cwc")[];
3753
+ }>;
3754
+ export declare const apiErrorResponseSchema: z.ZodObject<{
3755
+ statusCode: z.ZodNumber;
3756
+ message: z.ZodString;
3757
+ error: z.ZodString;
3758
+ details: z.ZodOptional<z.ZodAny>;
3759
+ }, "strip", z.ZodTypeAny, {
3760
+ error: string;
3761
+ message: string;
3762
+ statusCode: number;
3763
+ details?: any;
3764
+ }, {
3765
+ error: string;
3766
+ message: string;
3767
+ statusCode: number;
3768
+ details?: any;
3769
+ }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.voteResultsResponseDtoSchema = exports.userVoteResponseDtoSchema = exports.gamePlayersResponseDtoSchema = exports.teamPlayersResponseDtoSchema = exports.gameVoteResultsSchema = exports.mostVotedPlayerSchema = exports.voteSubmissionResponseDtoSchema = exports.voteSubmissionDtoSchema = exports.playerVoteSchema = void 0;
3
+ exports.apiErrorResponseSchema = exports.leagueSupportErrorSchema = exports.voteResultsResponseDtoSchema = exports.userVoteResponseDtoSchema = exports.gamePlayersResponseDtoSchema = exports.playerWithVotesSchema = exports.teamPlayersResponseDtoSchema = exports.gameVoteResultsSchema = exports.mostVotedPlayerSchema = exports.voteSubmissionResponseDtoSchema = exports.voteSubmissionDtoSchema = exports.playerVoteSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const sharedTypes_1 = require("./sharedTypes");
6
6
  const player_1 = require("./player");
@@ -45,17 +45,22 @@ exports.teamPlayersResponseDtoSchema = zod_1.z.object({
45
45
  league: sharedTypes_1.leagueSlug,
46
46
  players: zod_1.z.array(player_1.playerSchema),
47
47
  });
48
+ // Player with vote count schema
49
+ exports.playerWithVotesSchema = zod_1.z.object({
50
+ player: player_1.playerSchema,
51
+ votes: zod_1.z.number(),
52
+ });
48
53
  // Game Players Response DTO
49
54
  exports.gamePlayersResponseDtoSchema = zod_1.z.object({
50
55
  gameId: zod_1.z.string(),
51
56
  league: sharedTypes_1.leagueSlug,
52
57
  homeTeam: zod_1.z.object({
53
58
  teamId: zod_1.z.string(),
54
- players: zod_1.z.array(player_1.playerSchema),
59
+ players: zod_1.z.array(exports.playerWithVotesSchema),
55
60
  }),
56
61
  awayTeam: zod_1.z.object({
57
62
  teamId: zod_1.z.string(),
58
- players: zod_1.z.array(player_1.playerSchema),
63
+ players: zod_1.z.array(exports.playerWithVotesSchema),
59
64
  }),
60
65
  });
61
66
  // User Vote Response DTO
@@ -66,3 +71,18 @@ exports.userVoteResponseDtoSchema = zod_1.z.object({
66
71
  exports.voteResultsResponseDtoSchema = zod_1.z.object({
67
72
  results: exports.gameVoteResultsSchema,
68
73
  });
74
+ // League Support Error Response
75
+ exports.leagueSupportErrorSchema = zod_1.z.object({
76
+ statusCode: zod_1.z.number(),
77
+ message: zod_1.z.string(),
78
+ error: zod_1.z.string(),
79
+ league: sharedTypes_1.leagueSlug,
80
+ supportedLeagues: zod_1.z.array(sharedTypes_1.leagueSlug),
81
+ });
82
+ // API Error Response (Generic)
83
+ exports.apiErrorResponseSchema = zod_1.z.object({
84
+ statusCode: zod_1.z.number(),
85
+ message: zod_1.z.string(),
86
+ error: zod_1.z.string(),
87
+ details: zod_1.z.any().optional(),
88
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rategame-shared",
3
- "version": "1.1.243",
3
+ "version": "1.1.245",
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",