nhle-api 0.5.1 → 0.5.2

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/lib/index.js CHANGED
@@ -466,6 +466,9 @@ var getSeason = (date) => {
466
466
  return `${year}${parseInt(year, 10) + 1}`;
467
467
  };
468
468
  var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
469
+ /* @__PURE__ */ new Date(
470
+ `${getCurrentSeason().slice(4, 8)}-06-30`
471
+ );
469
472
 
470
473
  // src/constants/edge-adv.ts
471
474
  var edge_adv_exports = {};
@@ -966,6 +969,21 @@ var Year = type(`${nhl_exports.START_YEAR} <= number <= ${nhl_exports.END_YEAR}`
966
969
  return v >= nhl_exports.START_YEAR && v <= nhl_exports.END_YEAR;
967
970
  })
968
971
  ).describe(`a valid year from ${nhl_exports.START_YEAR} to ${nhl_exports.END_YEAR}`);
972
+ var NHLMonth = type("Date | string").narrow((v) => {
973
+ if (typeof v === "string") {
974
+ return /^\d{4}-\d{2}$/.test(v);
975
+ } else if (v instanceof Date) {
976
+ return true;
977
+ }
978
+ return false;
979
+ }).pipe((v) => typeof v === "string" ? v : v.toISOString().slice(0, 7)).describe(
980
+ "a valid month, either as a string (formatted as YYYY-MM) or a Date object"
981
+ );
982
+ var NHLDate = type("Date | string.date.iso").pipe(
983
+ (v) => typeof v === "string" ? new Date(v).toISOString().slice(0, 10) : v.toISOString().slice(0, 10)
984
+ ).describe(
985
+ "a valid date, either as a string (ISO date string) or a Date object"
986
+ );
969
987
  var Season = type("number.integer | string.numeric.parse").narrow((v) => {
970
988
  const yr = Math.trunc(v / 1e4);
971
989
  return typeof Year(yr) === "number" && yr + 1 === v % 1e4;
@@ -976,12 +994,15 @@ var TeamAbbrev = type.enumerated(
976
994
  nhl_exports.InactiveTeamsEnum
977
995
  )
978
996
  ).describe("a valid NHL team abbreviation");
979
- var TeamId = type.enumerated(...Object.values(nhl_exports.TeamsEnum)).describe("a valid NHL team ID");
997
+ var TeamId = type.enumerated(
998
+ ...Object.values(nhl_exports.TeamsEnum),
999
+ ...Object.values(nhl_exports.InactiveTeamsEnum)
1000
+ ).describe("a valid NHL team ID");
980
1001
  var GameType = type.enumerated(
981
1002
  ...Object.keys(
982
1003
  nhl_exports.GameTypeEnum
983
1004
  )
984
- ).pipe((v) => nhl_exports.GameTypeEnum[v]).or(type('1|2|3|4|19|"1"|"2"|"3"|"4"|"19"')).describe("a valid NHL game type (e.g., REG, PRE, POST)");
1005
+ ).pipe((v) => nhl_exports.GameTypeEnum[v]).or(type("1|2|3|4|19")).describe("a valid NHL game type (e.g., REG, PRE, POST)");
985
1006
  var GameNumber = type("number").atLeast(1).atMost(82 * 32 / 2).or(
986
1007
  type("string.numeric.parse").narrow((v) => {
987
1008
  return v >= 1 && v <= 82 * 32 / 2;
@@ -990,21 +1011,6 @@ var GameNumber = type("number").atLeast(1).atMost(82 * 32 / 2).or(
990
1011
  var DraftRound = type("1 <= number <= 7").or(type(/^(1|2|3|4|5|6|7)$/)).pipe((v) => typeof v === "number" ? v.toString() : v).describe("a valid NHL draft round (1-7)");
991
1012
  type("1 <= number <= 4").or(type(/^(1|2|3|4)$/)).pipe((v) => typeof v === "number" ? v.toString() : v).describe("a valid NHL playoff round (1-4)");
992
1013
  var EventId = type("number.integer | string.numeric.parse").narrow((v) => Number.isInteger(v) && v > 0).describe("a positive integer representing an NHL event ID");
993
- var NHLDate = type("Date | string.date.iso").pipe(
994
- (v) => typeof v === "string" ? new Date(v).toISOString().slice(0, 10) : v.toISOString().slice(0, 10)
995
- ).describe(
996
- "a valid date, either as a string (ISO date string) or a Date object"
997
- );
998
- type("Date | string").narrow((v) => {
999
- if (typeof v === "string") {
1000
- return /^\d{4}-\d{2}$/.test(v);
1001
- } else if (v instanceof Date) {
1002
- return true;
1003
- }
1004
- return false;
1005
- }).pipe((v) => typeof v === "string" ? v : v.toISOString().slice(0, 7)).describe(
1006
- "a valid month, either as a string (formatted as YYYY-MM) or a Date object"
1007
- );
1008
1014
  type("1|2|3|4|19").describe(
1009
1015
  "a valid NHL game type code (1=PRE, 2=REG, 3=POST, 4=ASG, 19=INTL)"
1010
1016
  );
@@ -1024,7 +1030,7 @@ var GameId = type("number.integer | string.numeric.parse").narrow((v) => {
1024
1030
  var SeriesLetter = type.enumerated(...Object.values(nhl_exports.SeriesLetterEnum)).describe("a valid NHL playoff series letter (A-O)");
1025
1031
  type.enumerated(...Object.values(nhl_exports.GameStateEnum)).describe("a valid NHL game state");
1026
1032
  var CountryCode = type(/^[a-zA-Z]{2}$/).pipe((v) => v.toLowerCase()).describe("a valid ISO 3166-1 alpha-2 country code, e.g. US, CA, RU");
1027
- var PostalCode = type(/^[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d$/).or(type(/^\d{5}$/)).describe(
1033
+ var PostalCode = type(/^[a-zA-Z]\d[a-zA-Z][ -]?\d[a-zA-Z]\d$/).or(type(/^\d{5}$/)).describe(
1028
1034
  "a valid postal code, either US ZIP code (5 digit) or Canadian postal code (A1A 1A1 format; space required)"
1029
1035
  );
1030
1036
  var PlayerId = type("number").atLeast(nhl_exports.PLAYER_ID_RANGE.MIN).atMost(nhl_exports.PLAYER_ID_RANGE.MAX).or(
@@ -1098,10 +1104,6 @@ var BaseParams = type({
1098
1104
  (v) => v ?? nhl_exports.GameTypeEnum.REG
1099
1105
  )
1100
1106
  });
1101
- type({
1102
- season: Season.or("undefined").optional(),
1103
- gameType: GameType.or("undefined").optional()
1104
- });
1105
1107
  BaseParams.merge({
1106
1108
  playerId: PlayerId,
1107
1109
  season: Season
@@ -1136,7 +1138,9 @@ var SeriesParams = type({
1136
1138
  var ScheduleParams = type({
1137
1139
  team: TeamAbbrev,
1138
1140
  date: NHLDate.or("undefined").pipe((v) => v ?? getCurrentDate()),
1139
- period: type('"week" | "month" | undefined').pipe((v) => v ?? "week")
1141
+ month: NHLMonth.or("undefined").pipe(
1142
+ (v) => v ?? getCurrentDate().slice(0, 7)
1143
+ )
1140
1144
  });
1141
1145
 
1142
1146
  // src/utils/utils.ts
@@ -1149,8 +1153,71 @@ function route(template, params) {
1149
1153
  return route2;
1150
1154
  }
1151
1155
 
1152
- // src/api/gamecenter/draft.ts
1153
- var _paths = {
1156
+ // src/api/gamecenter/_paths.ts
1157
+ var _teamPaths = {
1158
+ rosterSeasons: "roster-season/{team}",
1159
+ roster: "roster/{team}/{season}",
1160
+ prospects: "prospects/{team}",
1161
+ clubStats: "club-stats/{team}/{season}/{gameType}",
1162
+ clubStatsSeason: "club-stats-season/{team}",
1163
+ standings: "standings/{date}",
1164
+ standingsSeason: "standings-season",
1165
+ clubSchedule: {
1166
+ season: "club-schedule-season/{team}/{season}",
1167
+ month: "club-schedule/{team}/month/{month}",
1168
+ week: "club-schedule/{team}/week/{date}"
1169
+ }
1170
+ };
1171
+ var _scorePaths = {
1172
+ score: "score/{date}",
1173
+ scoreboard: {
1174
+ now: "scoreboard/now",
1175
+ byTeam: "scoreboard/{team}/now",
1176
+ byDate: "scoreboard/{date}"
1177
+ }
1178
+ };
1179
+ var _playerPaths = {
1180
+ landing: "player/{playerId}/landing",
1181
+ gameLog: "player/{playerId}/game-log/{season}/{gameType}",
1182
+ spotlight: "player-spotlight",
1183
+ statsLeaders: {
1184
+ skaters: "skater-stats-leaders/{season}/{gameType}",
1185
+ goalies: "goalie-stats-leaders/{season}/{gameType}"
1186
+ },
1187
+ playerSearch: "https://search.d3.nhle.com/api/v1/search/player"
1188
+ };
1189
+ var _miscPaths = {
1190
+ season: "season",
1191
+ metaPlayoffSeries: "meta/playoff-series/{year}/{seriesLetter}",
1192
+ metaGame: "meta/game/{gameId}",
1193
+ postalLookup: "postal-lookup/{postalCode}",
1194
+ location: "location",
1195
+ partnerGame: "partner-game/{countryCode}/now"
1196
+ };
1197
+ var _gamePaths = {
1198
+ schedule: "schedule/{date}",
1199
+ scheduleCalendar: "schedule-calendar/{date}",
1200
+ playoffBracket: "playoff-bracket/{year}",
1201
+ playoffSeries: "playoff-series/{season}",
1202
+ playoffSeriesSchedule: "schedule/playoff-series/{season}/{seriesLetter}",
1203
+ gamecenter: {
1204
+ playByPlay: "gamecenter/{gameId}/play-by-play",
1205
+ reports: "gamecenter/{gameId}/right-rail",
1206
+ landing: "gamecenter/{gameId}/landing",
1207
+ boxscore: "gamecenter/{gameId}/boxscore"
1208
+ },
1209
+ wsc: {
1210
+ gameStory: "wsc/game-story/{gameId}",
1211
+ playByPlay: "wsc/play-by-play/{gameId}"
1212
+ },
1213
+ pptReplay: {
1214
+ goal: "ppt-replay/goal/{gameId}/{eventId}",
1215
+ event: "ppt-replay/{gameId}/{eventId}"
1216
+ },
1217
+ whereToWatch: "where-to-watch",
1218
+ networkTVSchedule: "network/tv-schedule/{date}"
1219
+ };
1220
+ var _draftPaths = {
1154
1221
  draftPicks: {
1155
1222
  byYearAndRound: "draft/picks/{year}/{round}",
1156
1223
  byYear: "draft/picks/{year}/all"
@@ -1158,58 +1225,103 @@ var _paths = {
1158
1225
  draftRankings: "draft/rankings/{year}/{type}",
1159
1226
  draftTracker: "draft-tracker/picks/now"
1160
1227
  };
1161
- var DraftRankingsEnum = {
1162
- skatersNA: "1",
1163
- skatersIntl: "2",
1164
- goaliesNA: "3",
1165
- goaliesIntl: "4"
1166
- };
1167
- var picks = (year, round) => {
1228
+
1229
+ // src/api/gamecenter/draft.ts
1230
+ async function picks(year, round) {
1168
1231
  const parsed = DraftParams({ year, round });
1169
1232
  if (isParseError(parsed)) {
1170
- return Promise.resolve({
1233
+ return {
1171
1234
  status: "error",
1172
1235
  error: new ValidationError(parsed.summary, {
1173
- endpoint: _paths.draftPicks.byYearAndRound
1236
+ endpoint: _draftPaths.draftPicks.byYearAndRound
1174
1237
  })
1175
- });
1238
+ };
1176
1239
  }
1177
1240
  if (parsed.year && !parsed.round)
1178
- return client_default.get(route(_paths.draftPicks.byYear, parsed));
1179
- return client_default.get(route(_paths.draftPicks.byYearAndRound, parsed));
1180
- };
1181
- var tracker = () => client_default.get(_paths.draftTracker);
1182
- var rankings = (year) => {
1183
- const getRankings = (type2) => {
1241
+ return client_default.get(route(_draftPaths.draftPicks.byYear, parsed));
1242
+ return client_default.get(route(_draftPaths.draftPicks.byYearAndRound, parsed));
1243
+ }
1244
+ async function tracker() {
1245
+ return client_default.get(_draftPaths.draftTracker);
1246
+ }
1247
+ function rankings(year) {
1248
+ const DraftRankingsEnum = {
1249
+ skatersNA: "1",
1250
+ skatersIntl: "2",
1251
+ goaliesNA: "3",
1252
+ goaliesIntl: "4"
1253
+ };
1254
+ const getRankings = async (type2) => {
1184
1255
  const parsedYear = Year(year ?? getCurrentYear());
1185
1256
  if (isParseError(parsedYear)) {
1186
- return Promise.resolve({
1257
+ return {
1187
1258
  status: "error",
1188
1259
  error: new ValidationError(parsedYear.summary, {
1189
- endpoint: _paths.draftRankings
1260
+ endpoint: _draftPaths.draftRankings
1190
1261
  })
1191
- });
1262
+ };
1192
1263
  }
1193
1264
  return client_default.get(
1194
- route(_paths.draftRankings, {
1265
+ route(_draftPaths.draftRankings, {
1195
1266
  year: parsedYear,
1196
1267
  type: type2
1197
1268
  })
1198
1269
  );
1199
1270
  };
1200
1271
  return {
1201
- skatersNA: () => getRankings(DraftRankingsEnum.skatersNA),
1202
- skatersIntl: () => getRankings(DraftRankingsEnum.skatersIntl),
1203
- goaliesNA: () => getRankings(DraftRankingsEnum.goaliesNA),
1204
- goaliesIntl: () => getRankings(DraftRankingsEnum.goaliesIntl),
1205
- all: () => Promise.all([
1206
- getRankings(DraftRankingsEnum.skatersNA),
1207
- getRankings(DraftRankingsEnum.skatersIntl),
1208
- getRankings(DraftRankingsEnum.goaliesNA),
1209
- getRankings(DraftRankingsEnum.goaliesIntl)
1210
- ])
1272
+ /**
1273
+ * Get North American skater draft rankings
1274
+ * @returns Promise resolving to NA skater rankings
1275
+ */
1276
+ skatersNA: async () => getRankings(DraftRankingsEnum.skatersNA),
1277
+ /**
1278
+ * Get International skater draft rankings
1279
+ * @returns Promise resolving to International skater rankings
1280
+ */
1281
+ skatersIntl: async () => getRankings(DraftRankingsEnum.skatersIntl),
1282
+ /**
1283
+ * Get North American goalie draft rankings
1284
+ * @returns Promise resolving to NA goalie rankings
1285
+ */
1286
+ goaliesNA: async () => getRankings(DraftRankingsEnum.goaliesNA),
1287
+ /**
1288
+ * Get International goalie draft rankings
1289
+ * @returns Promise resolving to International goalie rankings
1290
+ */
1291
+ goaliesIntl: async () => getRankings(DraftRankingsEnum.goaliesIntl),
1292
+ /**
1293
+ * Get all draft rankings (NA/Intl skaters and goalies)
1294
+ * @returns Promise resolving to array of all rankings
1295
+ */
1296
+ all: async () => {
1297
+ const unwrapAPIResponse = (apiResponse) => {
1298
+ if (apiResponse.status === "success") {
1299
+ return apiResponse.data;
1300
+ }
1301
+ throw apiResponse.error;
1302
+ };
1303
+ const response = await Promise.all([
1304
+ getRankings(DraftRankingsEnum.skatersNA),
1305
+ getRankings(DraftRankingsEnum.skatersIntl),
1306
+ getRankings(DraftRankingsEnum.goaliesNA),
1307
+ getRankings(DraftRankingsEnum.goaliesIntl)
1308
+ ]);
1309
+ try {
1310
+ const dataOnly = response.map((r) => unwrapAPIResponse(r));
1311
+ const newResponse = {
1312
+ status: "success",
1313
+ data: dataOnly
1314
+ };
1315
+ return newResponse;
1316
+ } catch (error) {
1317
+ return {
1318
+ status: "error",
1319
+ error
1320
+ };
1321
+ }
1322
+ }
1211
1323
  };
1212
- };
1324
+ }
1213
1325
 
1214
1326
  // src/api/gamecenter/game.ts
1215
1327
  var game_exports = {};
@@ -1228,248 +1340,206 @@ __export(game_exports, {
1228
1340
  whereToWatch: () => whereToWatch,
1229
1341
  wsc: () => wsc
1230
1342
  });
1231
- var _paths2 = {
1232
- schedule: "schedule/{date}",
1233
- scheduleCalendar: "schedule-calendar/{date}",
1234
- playoffBracket: "playoff-bracket/{year}",
1235
- playoffSeries: "playoff-series/{season}",
1236
- playoffSeriesSchedule: "schedule/playoff-series/{season}/{seriesLetter}",
1237
- gamecenter: {
1238
- playByPlay: "gamecenter/{gameId}/play-by-play",
1239
- reports: "gamecenter/{gameId}/right-rail",
1240
- landing: "gamecenter/{gameId}/landing",
1241
- boxscore: "gamecenter/{gameId}/boxscore"
1242
- },
1243
- wsc: {
1244
- gameStory: "wsc/game-story/{gameId}",
1245
- playByPlay: "wsc/play-by-play/{gameId}"
1246
- },
1247
- pptReplay: {
1248
- goal: "ppt-replay/{gameId}/goal/{eventId}",
1249
- event: "ppt-replay/{date}"
1250
- },
1251
- whereToWatch: "where-to-watch",
1252
- networkTVSchedule: "network/tv-schedule/{date}"
1253
- };
1254
- var playByPlay = (gameId) => {
1343
+ async function playByPlay(gameId) {
1255
1344
  const parsedGameId = GameId(gameId);
1256
1345
  if (isParseError(parsedGameId)) {
1257
- return Promise.resolve({
1346
+ return {
1258
1347
  status: "error",
1259
1348
  error: new ValidationError(parsedGameId.summary, {
1260
- endpoint: _paths2.gamecenter.playByPlay
1349
+ endpoint: _gamePaths.gamecenter.playByPlay
1261
1350
  })
1262
- });
1351
+ };
1263
1352
  }
1264
1353
  return client_default.get(
1265
- route(_paths2.gamecenter.playByPlay, { gameId: parsedGameId })
1354
+ route(_gamePaths.gamecenter.playByPlay, { gameId: parsedGameId })
1266
1355
  );
1267
- };
1268
- var reports = (gameId) => {
1356
+ }
1357
+ async function reports(gameId) {
1269
1358
  const parsedGameId = GameId(gameId);
1270
1359
  if (isParseError(parsedGameId)) {
1271
- return Promise.resolve({
1360
+ return {
1272
1361
  status: "error",
1273
1362
  error: new ValidationError(parsedGameId.summary, {
1274
- endpoint: _paths2.gamecenter.reports
1363
+ endpoint: _gamePaths.gamecenter.reports
1275
1364
  })
1276
- });
1365
+ };
1277
1366
  }
1278
1367
  return client_default.get(
1279
- route(_paths2.gamecenter.reports, { gameId: parsedGameId })
1368
+ route(_gamePaths.gamecenter.reports, { gameId: parsedGameId })
1280
1369
  );
1281
- };
1282
- var landing = (gameId) => {
1370
+ }
1371
+ async function landing(gameId) {
1283
1372
  const parsedGameId = GameId(gameId);
1284
1373
  if (isParseError(parsedGameId)) {
1285
- return Promise.resolve({
1374
+ return {
1286
1375
  status: "error",
1287
1376
  error: new ValidationError(parsedGameId.summary, {
1288
- endpoint: _paths2.gamecenter.landing
1377
+ endpoint: _gamePaths.gamecenter.landing
1289
1378
  })
1290
- });
1379
+ };
1291
1380
  }
1292
1381
  return client_default.get(
1293
- route(_paths2.gamecenter.landing, { gameId: parsedGameId })
1382
+ route(_gamePaths.gamecenter.landing, { gameId: parsedGameId })
1294
1383
  );
1295
- };
1296
- var boxscore = (gameId) => {
1384
+ }
1385
+ async function boxscore(gameId) {
1297
1386
  const parsedGameId = GameId(gameId);
1298
1387
  if (isParseError(parsedGameId)) {
1299
- return Promise.resolve({
1388
+ return {
1300
1389
  status: "error",
1301
1390
  error: new ValidationError(parsedGameId.summary, {
1302
- endpoint: _paths2.gamecenter.boxscore
1391
+ endpoint: _gamePaths.gamecenter.boxscore
1303
1392
  })
1304
- });
1393
+ };
1305
1394
  }
1306
1395
  return client_default.get(
1307
- route(_paths2.gamecenter.boxscore, { gameId: parsedGameId })
1396
+ route(_gamePaths.gamecenter.boxscore, { gameId: parsedGameId })
1308
1397
  );
1309
- };
1398
+ }
1310
1399
  var wsc = {
1311
- /**
1312
- * Get game story data for a specific game
1313
- * @param gameId - The unique identifier for the game
1314
- * @returns Promise resolving to game story data
1315
- */
1316
- gameStory: (gameId) => {
1317
- const parsedGameId = GameId(gameId);
1318
- if (isParseError(parsedGameId)) {
1319
- return Promise.resolve({
1320
- status: "error",
1321
- error: new ValidationError(parsedGameId.summary, {
1322
- endpoint: _paths2.wsc.gameStory
1323
- })
1324
- });
1325
- }
1326
- return client_default.get(
1327
- route(_paths2.wsc.gameStory, { gameId: parsedGameId })
1328
- );
1329
- },
1330
- /**
1331
- * Get play-by-play data for a specific game
1332
- * @param gameId - The unique identifier for the game
1333
- * @returns Promise resolving to play-by-play data
1334
- */
1335
- playByPlay: (gameId) => {
1336
- const parsedGameId = GameId(gameId);
1337
- if (isParseError(parsedGameId)) {
1338
- return Promise.resolve({
1339
- status: "error",
1340
- error: new ValidationError(parsedGameId.summary, {
1341
- endpoint: _paths2.wsc.playByPlay
1342
- })
1343
- });
1344
- }
1345
- return client_default.get(
1346
- route(_paths2.wsc.playByPlay, { gameId: parsedGameId })
1347
- );
1348
- }
1400
+ gameStory: wscGameStory,
1401
+ playByPlay: wscPlayByPlay
1349
1402
  };
1350
- var pptReplay = {
1351
- /**
1352
- * Get goal replay data for a specific game and event
1353
- * @param gameId - The unique identifier for the game
1354
- * @param eventId - The unique identifier for the event
1355
- * @returns Promise resolving to goal replay data
1356
- */
1357
- goal: (gameId, eventId) => {
1358
- const parsed = GameIdAndEventId({ gameId, eventId });
1359
- if (isParseError(parsed)) {
1360
- return Promise.resolve({
1361
- status: "error",
1362
- error: new ValidationError(parsed.summary, {
1363
- endpoint: _paths2.pptReplay.goal
1364
- })
1365
- });
1366
- }
1367
- return client_default.get(
1368
- route(_paths2.pptReplay.goal, { gameId, eventId })
1369
- );
1370
- },
1371
- /**
1372
- * Get event replay data for a specific date
1373
- * @param date - Date to get event replay data for (Date object or ISO date string)
1374
- * @returns Promise resolving to event replay data
1375
- */
1376
- event: async (date) => {
1377
- const parsedDate = NHLDate(date);
1378
- if (isParseError(parsedDate)) {
1379
- return Promise.resolve({
1380
- status: "error",
1381
- error: new ValidationError(parsedDate.summary, {
1382
- endpoint: _paths2.pptReplay.event
1383
- })
1384
- });
1385
- }
1386
- return client_default.get(
1387
- route(_paths2.pptReplay.event, { date: parsedDate })
1388
- );
1403
+ async function wscGameStory(gameId) {
1404
+ const parsedGameId = GameId(gameId);
1405
+ if (isParseError(parsedGameId)) {
1406
+ return {
1407
+ status: "error",
1408
+ error: new ValidationError(parsedGameId.summary, {
1409
+ endpoint: _gamePaths.wsc.gameStory
1410
+ })
1411
+ };
1412
+ }
1413
+ return client_default.get(
1414
+ route(_gamePaths.wsc.gameStory, { gameId: parsedGameId })
1415
+ );
1416
+ }
1417
+ async function wscPlayByPlay(gameId) {
1418
+ const parsedGameId = GameId(gameId);
1419
+ if (isParseError(parsedGameId)) {
1420
+ return {
1421
+ status: "error",
1422
+ error: new ValidationError(parsedGameId.summary, {
1423
+ endpoint: _gamePaths.wsc.playByPlay
1424
+ })
1425
+ };
1389
1426
  }
1427
+ return client_default.get(
1428
+ route(_gamePaths.wsc.playByPlay, { gameId: parsedGameId })
1429
+ );
1430
+ }
1431
+ var pptReplay = {
1432
+ goal: pptReplayGoal,
1433
+ event: pptReplayEvent
1390
1434
  };
1391
- var schedule = (date) => {
1435
+ async function pptReplayGoal(gameId, eventId) {
1436
+ const parsed = GameIdAndEventId({ gameId, eventId });
1437
+ if (isParseError(parsed)) {
1438
+ return {
1439
+ status: "error",
1440
+ error: new ValidationError(parsed.summary, {
1441
+ endpoint: _gamePaths.pptReplay.goal
1442
+ })
1443
+ };
1444
+ }
1445
+ return client_default.get(route(_gamePaths.pptReplay.goal, { gameId, eventId }));
1446
+ }
1447
+ async function pptReplayEvent(gameId, eventId) {
1448
+ const parsed = GameIdAndEventId({ gameId, eventId });
1449
+ if (isParseError(parsed)) {
1450
+ return {
1451
+ status: "error",
1452
+ error: new ValidationError(parsed.summary, {
1453
+ endpoint: _gamePaths.pptReplay.event
1454
+ })
1455
+ };
1456
+ }
1457
+ return client_default.get(route(_gamePaths.pptReplay.event, { gameId, eventId }));
1458
+ }
1459
+ async function schedule(date) {
1392
1460
  const parsedDate = NHLDate(date ?? getCurrentDate());
1393
1461
  if (isParseError(parsedDate)) {
1394
- return Promise.resolve({
1462
+ return {
1395
1463
  status: "error",
1396
1464
  error: new ValidationError(parsedDate.summary, {
1397
- endpoint: _paths2.schedule
1465
+ endpoint: _gamePaths.schedule
1398
1466
  })
1399
- });
1467
+ };
1400
1468
  }
1401
- return client_default.get(route(_paths2.schedule, { date: parsedDate }));
1402
- };
1403
- var scheduleCalendar = (date) => {
1469
+ return client_default.get(route(_gamePaths.schedule, { date: parsedDate }));
1470
+ }
1471
+ async function scheduleCalendar(date) {
1404
1472
  const parsedDate = NHLDate(date);
1405
1473
  if (isParseError(parsedDate)) {
1406
- return Promise.resolve({
1474
+ return {
1407
1475
  status: "error",
1408
1476
  error: new ValidationError(parsedDate.summary, {
1409
- endpoint: _paths2.scheduleCalendar
1477
+ endpoint: _gamePaths.scheduleCalendar
1410
1478
  })
1411
- });
1479
+ };
1412
1480
  }
1413
1481
  return client_default.get(
1414
- route(_paths2.scheduleCalendar, { date: parsedDate })
1482
+ route(_gamePaths.scheduleCalendar, { date: parsedDate })
1415
1483
  );
1416
- };
1417
- var playoffBracket = (year) => {
1484
+ }
1485
+ async function playoffBracket(year) {
1418
1486
  const parsedYear = Year(year ?? getCurrentYear());
1419
1487
  if (isParseError(parsedYear)) {
1420
- return Promise.resolve({
1488
+ return {
1421
1489
  status: "error",
1422
1490
  error: new ValidationError(parsedYear.summary, {
1423
- endpoint: _paths2.playoffBracket
1491
+ endpoint: _gamePaths.playoffBracket
1424
1492
  })
1425
- });
1493
+ };
1426
1494
  }
1427
- return client_default.get(route(_paths2.playoffBracket, { year: parsedYear }));
1428
- };
1429
- var playoffSeries = (season) => {
1495
+ return client_default.get(route(_gamePaths.playoffBracket, { year: parsedYear }));
1496
+ }
1497
+ async function playoffSeries(season) {
1430
1498
  const parsedSeason = Season(season ?? getCurrentSeason());
1431
1499
  if (isParseError(parsedSeason)) {
1432
- return Promise.resolve({
1500
+ return {
1433
1501
  status: "error",
1434
1502
  error: new ValidationError(parsedSeason.summary, {
1435
- endpoint: _paths2.playoffSeries
1503
+ endpoint: _gamePaths.playoffSeries
1436
1504
  })
1437
- });
1505
+ };
1438
1506
  }
1439
1507
  return client_default.get(
1440
- route(_paths2.playoffSeries, { season: parsedSeason })
1508
+ route(_gamePaths.playoffSeries, { season: parsedSeason })
1441
1509
  );
1442
- };
1443
- var playoffSeriesSchedule = (seriesLetter, season) => {
1510
+ }
1511
+ async function playoffSeriesSchedule(seriesLetter, season) {
1444
1512
  const parsed = SeriesAndSeasonParams({
1445
1513
  seriesLetter,
1446
1514
  season: season ?? getCurrentSeason()
1447
1515
  });
1448
1516
  if (isParseError(parsed)) {
1449
- return Promise.resolve({
1517
+ return {
1450
1518
  status: "error",
1451
1519
  error: new ValidationError(parsed.summary, {
1452
- endpoint: _paths2.playoffSeriesSchedule
1520
+ endpoint: _gamePaths.playoffSeriesSchedule
1453
1521
  })
1454
- });
1522
+ };
1455
1523
  }
1456
- return client_default.get(route(_paths2.playoffSeriesSchedule, parsed));
1457
- };
1458
- var whereToWatch = () => client_default.get(_paths2.whereToWatch);
1459
- var networkTVSchedule = (date) => {
1524
+ return client_default.get(route(_gamePaths.playoffSeriesSchedule, parsed));
1525
+ }
1526
+ async function whereToWatch() {
1527
+ return client_default.get(_gamePaths.whereToWatch);
1528
+ }
1529
+ async function networkTVSchedule(date) {
1460
1530
  const parsedDate = NHLDate(date ?? getCurrentDate());
1461
1531
  if (isParseError(parsedDate)) {
1462
- return Promise.resolve({
1532
+ return {
1463
1533
  status: "error",
1464
1534
  error: new ValidationError(parsedDate.summary, {
1465
- endpoint: _paths2.networkTVSchedule
1535
+ endpoint: _gamePaths.networkTVSchedule
1466
1536
  })
1467
- });
1537
+ };
1468
1538
  }
1469
1539
  return client_default.get(
1470
- route(_paths2.networkTVSchedule, { date: parsedDate })
1540
+ route(_gamePaths.networkTVSchedule, { date: parsedDate })
1471
1541
  );
1472
- };
1542
+ }
1473
1543
 
1474
1544
  // src/api/gamecenter/misc.ts
1475
1545
  var misc_exports = {};
@@ -1480,89 +1550,68 @@ __export(misc_exports, {
1480
1550
  postalLookup: () => postalLookup,
1481
1551
  seasons: () => seasons
1482
1552
  });
1483
- var _paths3 = {
1484
- season: "season",
1485
- metaPlayoffSeries: "meta/playoff-series/{year}/{seriesLetter}",
1486
- metaGame: "meta/game/{gameId}",
1487
- postalLookup: "postal-lookup/{postalCode}",
1488
- location: "location",
1489
- partnerGame: "partner-game/{countryCode}/now"
1490
- };
1491
- var seasons = () => {
1492
- return client_default.get(_paths3.season);
1493
- };
1553
+ async function seasons() {
1554
+ return client_default.get(_miscPaths.season);
1555
+ }
1494
1556
  var meta = {
1495
- /**
1496
- * Get meta information for a playoff series
1497
- *
1498
- * @param year - The year in YYYY format
1499
- * @param seriesLetter - Single letter identifier for the playoff series
1500
- * @returns Promise resolving to playoff series meta information
1501
- */
1502
- playoffSeries: (seriesLetter, year) => {
1503
- const parsed = SeriesParams({ year, seriesLetter });
1504
- if (isParseError(parsed)) {
1505
- return Promise.resolve({
1506
- status: "error",
1507
- error: new ValidationError(parsed.summary, {
1508
- endpoint: _paths3.metaPlayoffSeries
1509
- })
1510
- });
1511
- }
1512
- return client_default.get(route(_paths3.metaPlayoffSeries, parsed));
1513
- },
1514
- /**
1515
- * Get meta information for a specific game
1516
- *
1517
- * @param gameId - The unique game identifier
1518
- * @returns Promise resolving to game meta information
1519
- */
1520
- game: (gameId) => {
1521
- const parsedGameId = GameId(gameId);
1522
- if (isParseError(parsedGameId)) {
1523
- return Promise.resolve({
1524
- status: "error",
1525
- error: new ValidationError(parsedGameId.summary, {
1526
- endpoint: _paths3.metaGame
1527
- })
1528
- });
1529
- }
1530
- return client_default.get(
1531
- route(_paths3.metaGame, { gameId: parsedGameId })
1532
- );
1533
- }
1557
+ game: metaGame,
1558
+ playoffSeries: metaPlayoffSeries
1534
1559
  };
1535
- var postalLookup = (postalCode) => {
1560
+ async function metaGame(gameId) {
1561
+ const parsedGameId = GameId(gameId);
1562
+ if (isParseError(parsedGameId)) {
1563
+ return {
1564
+ status: "error",
1565
+ error: new ValidationError(parsedGameId.summary, {
1566
+ endpoint: _miscPaths.metaGame
1567
+ })
1568
+ };
1569
+ }
1570
+ return client_default.get(route(_miscPaths.metaGame, { gameId: parsedGameId }));
1571
+ }
1572
+ async function metaPlayoffSeries(seriesLetter, year) {
1573
+ const parsed = SeriesParams({ year, seriesLetter });
1574
+ if (isParseError(parsed)) {
1575
+ return {
1576
+ status: "error",
1577
+ error: new ValidationError(parsed.summary, {
1578
+ endpoint: _miscPaths.metaPlayoffSeries
1579
+ })
1580
+ };
1581
+ }
1582
+ return client_default.get(route(_miscPaths.metaPlayoffSeries, parsed));
1583
+ }
1584
+ async function postalLookup(postalCode) {
1536
1585
  const parsedPostalCode = PostalCode(postalCode);
1537
1586
  if (isParseError(parsedPostalCode)) {
1538
- return Promise.resolve({
1587
+ return {
1539
1588
  status: "error",
1540
1589
  error: new ValidationError(parsedPostalCode.summary, {
1541
- endpoint: _paths3.postalLookup
1590
+ endpoint: _miscPaths.postalLookup
1542
1591
  })
1543
- });
1592
+ };
1544
1593
  }
1545
1594
  return client_default.get(
1546
- route(_paths3.postalLookup, { postalCode: parsedPostalCode })
1595
+ route(_miscPaths.postalLookup, { postalCode: parsedPostalCode })
1547
1596
  );
1548
- };
1549
- var location = () => {
1550
- return client_default.get(_paths3.location);
1551
- };
1552
- var partnerGame = (countryCode) => {
1597
+ }
1598
+ async function location() {
1599
+ return client_default.get(_miscPaths.location);
1600
+ }
1601
+ async function partnerGame(countryCode) {
1553
1602
  const parsedCountryCode = CountryCode(countryCode);
1554
1603
  if (isParseError(parsedCountryCode)) {
1555
- return Promise.resolve({
1604
+ return {
1556
1605
  status: "error",
1557
1606
  error: new ValidationError(parsedCountryCode.summary, {
1558
- endpoint: _paths3.partnerGame
1607
+ endpoint: _miscPaths.partnerGame
1559
1608
  })
1560
- });
1609
+ };
1561
1610
  }
1562
1611
  return client_default.get(
1563
- route(_paths3.partnerGame, { countryCode: parsedCountryCode })
1612
+ route(_miscPaths.partnerGame, { countryCode: parsedCountryCode })
1564
1613
  );
1565
- };
1614
+ }
1566
1615
 
1567
1616
  // src/api/gamecenter/player.ts
1568
1617
  var player_exports = {};
@@ -1573,325 +1622,250 @@ __export(player_exports, {
1573
1622
  spotlight: () => spotlight,
1574
1623
  statsLeaders: () => statsLeaders
1575
1624
  });
1576
- var _paths4 = {
1577
- landing: "player/{playerId}/landing",
1578
- gameLog: "player/{playerId}/game-log/{season}/{gameType}",
1579
- spotlight: "player-spotlight",
1580
- statsLeaders: {
1581
- skaters: "skater-stats-leaders/{season}/{gameType}",
1582
- goalies: "goalie-stats-leaders/{season}/{gameType}"
1583
- },
1584
- playerSearch: "https://search.d3.nhle.com/api/v1/search/player"
1585
- };
1586
- var nhlPlayerSearch = createNHLClient(_paths4.playerSearch);
1625
+ var nhlPlayerSearch = createNHLClient(_playerPaths.playerSearch);
1587
1626
  var searchUrlParams = { culture: "en", q: "" };
1588
- var landing2 = (playerId) => {
1627
+ async function landing2(playerId) {
1589
1628
  const parsedPlayerId = PlayerId(playerId);
1590
1629
  if (isParseError(parsedPlayerId)) {
1591
- return Promise.resolve({
1630
+ return {
1592
1631
  status: "error",
1593
1632
  error: new ValidationError(parsedPlayerId.summary, {
1594
- endpoint: _paths4.landing
1633
+ endpoint: _playerPaths.landing
1595
1634
  })
1596
- });
1635
+ };
1597
1636
  }
1598
1637
  return client_default.get(
1599
- route(_paths4.landing, { playerId: parsedPlayerId })
1638
+ route(_playerPaths.landing, { playerId: parsedPlayerId })
1600
1639
  );
1601
- };
1602
- var gameLog = (playerId, season, gameType) => {
1640
+ }
1641
+ async function gameLog(playerId, season, gameType) {
1603
1642
  const Parser = BaseParams.merge({
1604
1643
  playerId: PlayerId
1605
1644
  });
1606
1645
  const parsed = Parser({ playerId, season, gameType });
1607
1646
  if (isParseError(parsed)) {
1608
- return Promise.resolve({
1647
+ return {
1609
1648
  status: "error",
1610
1649
  error: new ValidationError(parsed.summary, {
1611
- endpoint: _paths4.gameLog
1650
+ endpoint: _playerPaths.gameLog
1612
1651
  })
1613
- });
1652
+ };
1614
1653
  }
1615
- return client_default.get(route(_paths4.gameLog, parsed));
1616
- };
1617
- var spotlight = () => {
1618
- return client_default.get(_paths4.spotlight);
1619
- };
1620
- var search = (query) => {
1654
+ return client_default.get(route(_playerPaths.gameLog, parsed));
1655
+ }
1656
+ async function spotlight() {
1657
+ return client_default.get(_playerPaths.spotlight);
1658
+ }
1659
+ async function search(query) {
1621
1660
  return nhlPlayerSearch.get("", {
1622
1661
  ...searchUrlParams,
1623
1662
  q: query
1624
1663
  });
1625
- };
1664
+ }
1626
1665
  var statsLeaders = {
1627
- /**
1628
- * Get skater stats leaders
1629
- * @param season - The season identifier (optional)
1630
- * @param gameType - The game type identifier (optional)
1631
- * @returns Promise resolving to skater stats leaders
1632
- */
1633
- skaters: (season, gameType) => {
1634
- const parsed = BaseParams({ season, gameType });
1635
- if (isParseError(parsed)) {
1636
- return Promise.resolve({
1637
- status: "error",
1638
- error: new ValidationError(parsed.summary, {
1639
- endpoint: _paths4.statsLeaders.skaters
1640
- })
1641
- });
1642
- }
1643
- return client_default.get(route(_paths4.statsLeaders.skaters, parsed));
1644
- },
1645
- /**
1646
- * Get goalie stats leaders
1647
- * @param season - The season identifier (optional)
1648
- * @param gameType - The game type identifier (optional)
1649
- * @returns Promise resolving to goalie stats leaders
1650
- */
1651
- goalies: (season, gameType) => {
1652
- const parsed = BaseParams({ season, gameType });
1653
- if (isParseError(parsed)) {
1654
- return Promise.resolve({
1655
- status: "error",
1656
- error: new ValidationError(parsed.summary, {
1657
- endpoint: _paths4.statsLeaders.goalies
1658
- })
1659
- });
1660
- }
1661
- return client_default.get(route(_paths4.statsLeaders.goalies, parsed));
1662
- }
1666
+ skaters: statsLeadersSkaters,
1667
+ goalies: statsLeadersGoalies
1663
1668
  };
1669
+ async function statsLeadersSkaters(season, gameType) {
1670
+ const parsed = BaseParams({ season, gameType });
1671
+ if (isParseError(parsed)) {
1672
+ return {
1673
+ status: "error",
1674
+ error: new ValidationError(parsed.summary, {
1675
+ endpoint: _playerPaths.statsLeaders.skaters
1676
+ })
1677
+ };
1678
+ }
1679
+ return client_default.get(route(_playerPaths.statsLeaders.skaters, parsed));
1680
+ }
1681
+ async function statsLeadersGoalies(season, gameType) {
1682
+ const parsed = BaseParams({ season, gameType });
1683
+ if (isParseError(parsed)) {
1684
+ return {
1685
+ status: "error",
1686
+ error: new ValidationError(parsed.summary, {
1687
+ endpoint: _playerPaths.statsLeaders.goalies
1688
+ })
1689
+ };
1690
+ }
1691
+ return client_default.get(route(_playerPaths.statsLeaders.goalies, parsed));
1692
+ }
1664
1693
 
1665
1694
  // src/api/gamecenter/score.ts
1666
- var _paths5 = {
1667
- score: "score/{date}",
1668
- scoreboard: {
1669
- now: "scoreboard/now",
1670
- byTeam: "scoreboard/{team}/now",
1671
- byDate: "scoreboard/{date}"
1672
- }
1673
- };
1674
- var score = (date) => {
1695
+ async function score(date) {
1675
1696
  const parsed = NHLDate(date ?? getCurrentDate());
1676
1697
  if (isParseError(parsed)) {
1677
- return Promise.resolve({
1698
+ return {
1678
1699
  status: "error",
1679
1700
  error: new ValidationError(parsed.summary, {
1680
- endpoint: _paths5.score
1701
+ endpoint: _scorePaths.score
1681
1702
  })
1682
- });
1703
+ };
1683
1704
  }
1684
- return client_default.get(route(_paths5.score, { date: parsed }));
1685
- };
1686
- var scoreboard = () => client_default.get(_paths5.scoreboard.now);
1705
+ return client_default.get(route(_scorePaths.score, { date: parsed }));
1706
+ }
1707
+ async function scoreboard() {
1708
+ return client_default.get(_scorePaths.scoreboard.now);
1709
+ }
1687
1710
  scoreboard.team = async (team) => {
1688
1711
  const parsed = TeamAbbrev(team);
1689
1712
  if (isParseError(parsed)) {
1690
- return Promise.resolve({
1713
+ return {
1691
1714
  status: "error",
1692
1715
  error: new ValidationError(parsed.summary, {
1693
- endpoint: _paths5.scoreboard.byTeam
1716
+ endpoint: _scorePaths.scoreboard.byTeam
1694
1717
  })
1695
- });
1718
+ };
1696
1719
  }
1697
1720
  return client_default.get(
1698
- route(_paths5.scoreboard.byTeam, { team: parsed })
1721
+ route(_scorePaths.scoreboard.byTeam, { team: parsed })
1699
1722
  );
1700
1723
  };
1701
1724
  scoreboard.date = async (date) => {
1702
1725
  const parsed = NHLDate(date);
1703
1726
  if (isParseError(parsed)) {
1704
- return Promise.resolve({
1727
+ return {
1705
1728
  status: "error",
1706
1729
  error: new ValidationError(parsed.summary, {
1707
- endpoint: _paths5.scoreboard.byDate
1730
+ endpoint: _scorePaths.scoreboard.byDate
1708
1731
  })
1709
- });
1732
+ };
1710
1733
  }
1711
1734
  return client_default.get(
1712
- route(_paths5.scoreboard.byDate, { date: parsed })
1735
+ route(_scorePaths.scoreboard.byDate, { date: parsed })
1713
1736
  );
1714
1737
  };
1715
1738
 
1716
1739
  // src/api/gamecenter/team.ts
1717
1740
  var team_exports = {};
1718
1741
  __export(team_exports, {
1719
- clubStats: () => clubStats,
1720
- clubStatsSeason: () => clubStatsSeason,
1721
1742
  prospects: () => prospects,
1722
1743
  roster: () => roster,
1723
1744
  rosterSeasons: () => rosterSeasons,
1724
1745
  schedule: () => schedule2,
1725
1746
  standings: () => standings,
1726
- standingsSeason: () => standingsSeason
1747
+ standingsSeason: () => standingsSeason,
1748
+ stats: () => stats,
1749
+ statsSeason: () => statsSeason
1727
1750
  });
1728
- var paths = {
1729
- rosterSeasons: "roster-season/{team}",
1730
- roster: "roster/{team}/{season}",
1731
- prospects: "prospects/{team}",
1732
- clubStats: "club-stats/{team}/{season}/{gameType}",
1733
- clubStatsSeason: "club-stats-season/{team}",
1734
- standings: "standings/{date}",
1735
- standingsSeason: "standings-season",
1736
- clubSchedule: "club-schedule/{team}/{period}/{date}",
1737
- clubScheduleSeason: "club-schedule-season/{team}/{season}"
1738
- };
1739
- var rosterSeasons = (team) => {
1751
+ async function rosterSeasons(team) {
1740
1752
  const parsed = TeamAbbrev(team);
1741
1753
  if (isParseError(parsed)) {
1742
- return Promise.resolve({
1754
+ return {
1743
1755
  status: "error",
1744
1756
  error: new ValidationError(parsed.summary, {
1745
- endpoint: paths.rosterSeasons
1757
+ endpoint: _teamPaths.rosterSeasons
1746
1758
  })
1747
- });
1759
+ };
1748
1760
  }
1749
- return client_default.get(route(paths.rosterSeasons, { team: parsed }));
1750
- };
1751
- var roster = (team, season) => {
1761
+ return client_default.get(route(_teamPaths.rosterSeasons, { team: parsed }));
1762
+ }
1763
+ async function roster(team, season) {
1752
1764
  const parsed = TeamAndSeasonParams({ team, season });
1753
1765
  if (isParseError(parsed)) {
1754
- return Promise.resolve({
1766
+ return {
1755
1767
  status: "error",
1756
1768
  error: new ValidationError(parsed.summary, {
1757
- endpoint: paths.roster
1769
+ endpoint: _teamPaths.roster
1758
1770
  })
1759
- });
1771
+ };
1760
1772
  }
1761
- return client_default.get(route(paths.roster, parsed));
1762
- };
1763
- var prospects = (team) => {
1773
+ return client_default.get(route(_teamPaths.roster, parsed));
1774
+ }
1775
+ async function prospects(team) {
1764
1776
  const parsed = TeamAbbrev(team);
1765
1777
  if (isParseError(parsed)) {
1766
- return Promise.resolve({
1778
+ return {
1767
1779
  status: "error",
1768
1780
  error: new ValidationError(parsed.summary, {
1769
- endpoint: paths.prospects
1781
+ endpoint: _teamPaths.prospects
1770
1782
  })
1771
- });
1783
+ };
1772
1784
  }
1773
- return client_default.get(route(paths.prospects, { team: parsed }));
1774
- };
1775
- var clubStats = (team, season, gameType) => {
1785
+ return client_default.get(route(_teamPaths.prospects, { team: parsed }));
1786
+ }
1787
+ async function stats(team, season, gameType) {
1776
1788
  const Parser = BaseParams.merge({
1777
1789
  team: TeamAbbrev
1778
1790
  });
1779
1791
  const parsed = Parser({ team, season, gameType });
1780
1792
  if (isParseError(parsed)) {
1781
- return Promise.resolve({
1793
+ return {
1782
1794
  status: "error",
1783
1795
  error: new ValidationError(parsed.summary, {
1784
- endpoint: paths.clubStats
1796
+ endpoint: _teamPaths.clubStats
1785
1797
  })
1786
- });
1798
+ };
1787
1799
  }
1788
- return client_default.get(route(paths.clubStats, parsed));
1789
- };
1790
- var clubStatsSeason = (team) => {
1800
+ return client_default.get(route(_teamPaths.clubStats, parsed));
1801
+ }
1802
+ async function statsSeason(team) {
1791
1803
  const parsed = TeamAbbrev(team);
1792
1804
  if (isParseError(parsed)) {
1793
- return Promise.resolve({
1805
+ return {
1794
1806
  status: "error",
1795
1807
  error: new ValidationError(parsed.summary, {
1796
- endpoint: paths.clubStatsSeason
1808
+ endpoint: _teamPaths.clubStatsSeason
1797
1809
  })
1798
- });
1810
+ };
1799
1811
  }
1800
- return client_default.get(route(paths.clubStatsSeason, { team: parsed }));
1801
- };
1802
- var standings = (date) => {
1812
+ return client_default.get(route(_teamPaths.clubStatsSeason, { team: parsed }));
1813
+ }
1814
+ async function standings(date) {
1803
1815
  const parsed = NHLDate(date ?? getCurrentDate());
1804
1816
  if (isParseError(parsed)) {
1805
- return Promise.resolve({
1817
+ return {
1806
1818
  status: "error",
1807
1819
  error: new ValidationError(parsed.summary, {
1808
- endpoint: paths.standings
1820
+ endpoint: _teamPaths.standings
1809
1821
  })
1810
- });
1822
+ };
1811
1823
  }
1812
- return client_default.get(route(paths.standings, { date: parsed }));
1813
- };
1814
- var standingsSeason = () => {
1815
- return client_default.get(paths.standingsSeason);
1816
- };
1817
- var clubSchedule = (team, date, period) => {
1818
- const parsed = ScheduleParams({ team, date, period });
1824
+ return client_default.get(route(_teamPaths.standings, { date: parsed }));
1825
+ }
1826
+ async function standingsSeason() {
1827
+ return client_default.get(_teamPaths.standingsSeason);
1828
+ }
1829
+ async function scheduleWeek(team, date) {
1830
+ const parsed = ScheduleParams({ team, date, month: void 0 });
1819
1831
  if (isParseError(parsed)) {
1820
- return Promise.resolve({
1832
+ return {
1821
1833
  status: "error",
1822
1834
  error: new ValidationError(parsed.summary, {
1823
- endpoint: paths.clubSchedule
1835
+ endpoint: _teamPaths.clubSchedule.week
1824
1836
  })
1825
- });
1837
+ };
1826
1838
  }
1827
- if (period === "month") {
1828
- parsed.date = parsed.date?.slice(0, 7);
1839
+ return client_default.get(route(_teamPaths.clubSchedule.week, parsed));
1840
+ }
1841
+ async function scheduleMonth(team, date) {
1842
+ const parsed = ScheduleParams({ team, month: date, date: void 0 });
1843
+ if (isParseError(parsed)) {
1844
+ return {
1845
+ status: "error",
1846
+ error: new ValidationError(parsed.summary, {
1847
+ endpoint: _teamPaths.clubSchedule.month
1848
+ })
1849
+ };
1829
1850
  }
1830
- return client_default.get(route(paths.clubSchedule, parsed));
1831
- };
1832
- var clubScheduleSeason = (team, season) => {
1851
+ return client_default.get(route(_teamPaths.clubSchedule.month, parsed));
1852
+ }
1853
+ async function scheduleSeason(team, season) {
1833
1854
  const parsed = TeamAndSeasonParams({ team, season });
1834
1855
  if (isParseError(parsed)) {
1835
- return Promise.resolve({
1856
+ return {
1836
1857
  status: "error",
1837
1858
  error: new ValidationError(parsed.summary, {
1838
- endpoint: paths.clubScheduleSeason
1859
+ endpoint: _teamPaths.clubSchedule.season
1839
1860
  })
1840
- });
1861
+ };
1841
1862
  }
1842
- return client_default.get(route(paths.clubScheduleSeason, parsed));
1843
- };
1863
+ return client_default.get(route(_teamPaths.clubSchedule.season, parsed));
1864
+ }
1844
1865
  var schedule2 = {
1845
- /** Returns the full season schedule for the provided team and season
1846
- * @param team - The team abbreviation for the desired team
1847
- * @param season - The specific season (e.g. 20222023); if not provided, defaults to the current season.
1848
- * @returns A promise that resolves to the full season schedule for the specified team and season
1849
- * @example
1850
- * ```ts
1851
- * // Get the full season schedule for the Boston Bruins for the 2022-2023 season
1852
- * schedule.season('BOS', 20222023).then((data) => {
1853
- * console.log(data);
1854
- * });
1855
- * ```
1856
- */
1857
- season: clubScheduleSeason,
1858
- /**
1859
- * Get the team schedule for any seven-day period
1860
- * @param team - The team abbreviation
1861
- * @param date - The date indicating the start of the seven-day period.
1862
- * If not provided, defaults to the current date. format: 'YYYY-MM'
1863
- * @returns A promise that resolves to the club schedule for the specified week
1864
- *
1865
- * @example
1866
- * ```ts
1867
- * import { schedule } from 'nhle-api';
1868
- *
1869
- * // Get the schedule for the Chicago Blackhawks for the week of November 4, 2023
1870
- * // This returns the schedule from November 4 to November 10, 2023
1871
- * schedule.week('CHI', '2023-11-04').then((data) => {
1872
- * console.log(data);
1873
- * });
1874
- * ```
1875
- */
1876
- week: (team, date) => clubSchedule(team, date, "week"),
1877
- /**
1878
- * Get the team schedule for any month
1879
- * @param team - The team abbreviation
1880
- * @param date - The date indicating the month to get the schedule for.
1881
- * If not provided, defaults to the current month. format: 'YYYY-MM'
1882
- * @returns A promise that resolves to the club schedule for the specified month
1883
- *
1884
- * @example
1885
- * ```ts
1886
- * import { schedule } from 'nhle-api';
1887
- *
1888
- * // Get the schedule for the Toronto Maple Leafs for November 2023
1889
- * schedule.month('TOR', '2023-11').then((data) => {
1890
- * console.log(data);
1891
- * });
1892
- * ```
1893
- */
1894
- month: (team, date) => clubSchedule(team, date, "month")
1866
+ season: scheduleSeason,
1867
+ week: scheduleWeek,
1868
+ month: scheduleMonth
1895
1869
  };
1896
1870
 
1897
1871
  export { EDGE, nhl_exports as NHL, envConfig, gamecenter_exports as gc, logEnvConfig };