nhle-api 0.5.1

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.cjs ADDED
@@ -0,0 +1,1905 @@
1
+ 'use strict';
2
+
3
+ var arktype = require('arktype');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+
11
+ // src/api/gamecenter/index.ts
12
+ var gamecenter_exports = {};
13
+ __export(gamecenter_exports, {
14
+ draft: () => draft_exports,
15
+ game: () => game_exports,
16
+ misc: () => misc_exports,
17
+ player: () => player_exports,
18
+ score: () => score,
19
+ scoreboard: () => scoreboard,
20
+ team: () => team_exports
21
+ });
22
+
23
+ // src/api/gamecenter/draft.ts
24
+ var draft_exports = {};
25
+ __export(draft_exports, {
26
+ picks: () => picks,
27
+ rankings: () => rankings,
28
+ tracker: () => tracker
29
+ });
30
+
31
+ // src/config/env.ts
32
+ function parseTimeout() {
33
+ const timeout = process.env.NHLE_API_TIMEOUT;
34
+ if (!timeout) return 5e3;
35
+ const parsed = parseInt(timeout, 10);
36
+ if (Number.isNaN(parsed) || parsed <= 0) {
37
+ console.warn(
38
+ `Invalid NHLE_API_TIMEOUT: "${timeout}". Using default 5000ms`
39
+ );
40
+ return 5e3;
41
+ }
42
+ return parsed;
43
+ }
44
+ function parseLanguage() {
45
+ const language = process.env.NHLE_API_LANGUAGE?.toLowerCase();
46
+ if (language === "fr") return "fr";
47
+ if (language && language !== "en") {
48
+ console.warn(
49
+ `Invalid NHLE_API_LANGUAGE: "${language}". Using default 'en'`
50
+ );
51
+ }
52
+ return "en";
53
+ }
54
+ function parseLogLevel() {
55
+ const logLevel = process.env.NHLE_API_LOGLEVEL?.toLowerCase();
56
+ const validLevels = [
57
+ "silent",
58
+ "error",
59
+ "warn",
60
+ "info",
61
+ "debug"
62
+ ];
63
+ if (!logLevel) return "warn";
64
+ if (validLevels.includes(logLevel)) {
65
+ return logLevel;
66
+ }
67
+ console.warn(
68
+ `Invalid NHLE_API_LOGLEVEL: "${logLevel}". Valid options: ${validLevels.join(", ")}. Using default 'warn'`
69
+ );
70
+ return "warn";
71
+ }
72
+ var envConfig = {
73
+ /**
74
+ * Request timeout in milliseconds
75
+ * Set via NHLE_API_TIMEOUT environment variable
76
+ * @default 5000
77
+ */
78
+ timeout: parseTimeout(),
79
+ /**
80
+ * Language code for API responses
81
+ * Set via NHLE_API_LANGUAGE environment variable
82
+ * @default 'en'
83
+ */
84
+ language: parseLanguage(),
85
+ /**
86
+ * Logging level for the client
87
+ * Set via NHLE_API_LOGLEVEL environment variable
88
+ * @default 'warn'
89
+ */
90
+ logLevel: parseLogLevel()
91
+ };
92
+ function logEnvConfig() {
93
+ const vars = {
94
+ timeout: process.env.NHLE_API_TIMEOUT,
95
+ language: process.env.NHLE_API_LANGUAGE,
96
+ logLevel: process.env.NHLE_API_LOGLEVEL
97
+ };
98
+ const configured = Object.entries(vars).filter(
99
+ ([, v]) => v !== void 0
100
+ );
101
+ if (configured.length > 0) {
102
+ console.debug("NHL API Environment Configuration:", {
103
+ ...Object.fromEntries(configured),
104
+ resolvedTimeout: envConfig.timeout,
105
+ resolvedLanguage: envConfig.language,
106
+ resolvedLogLevel: envConfig.logLevel
107
+ });
108
+ }
109
+ }
110
+
111
+ // src/errors/index.ts
112
+ var ErrorCategory = {
113
+ /** Network-level errors (connection refused, timeout, etc.) */
114
+ NETWORK: "NETWORK",
115
+ /** HTTP 4xx client errors (invalid params, not found, etc.) */
116
+ CLIENT: "CLIENT",
117
+ /** HTTP 5xx server errors */
118
+ SERVER: "SERVER",
119
+ /** Rate limiting (HTTP 429) */
120
+ RATE_LIMIT: "RATE_LIMIT",
121
+ /** Valid HTTP response but with error payload */
122
+ API_ERROR: "API_ERROR",
123
+ /** Response parsing/validation failures */
124
+ PARSE: "PARSE",
125
+ /** Invalid user input or configuration */
126
+ VALIDATION: "VALIDATION"
127
+ };
128
+ var LogLevel = {
129
+ ERROR: 1,
130
+ WARN: 2,
131
+ INFO: 3,
132
+ DEBUG: 4
133
+ };
134
+ var NHLError = class extends Error {
135
+ category;
136
+ context;
137
+ constructor(message, category, context = {}) {
138
+ super(message);
139
+ this.name = this.constructor.name;
140
+ this.category = category;
141
+ this.context = {
142
+ ...context,
143
+ timestamp: context.timestamp || /* @__PURE__ */ new Date()
144
+ };
145
+ Error.captureStackTrace?.(this, this.constructor);
146
+ }
147
+ /**
148
+ * Serialize error to JSON
149
+ */
150
+ toJSON() {
151
+ return {
152
+ name: this.name,
153
+ message: this.message,
154
+ category: this.category,
155
+ context: this.context,
156
+ ...this.stack && { stack: this.stack }
157
+ };
158
+ }
159
+ };
160
+ var NetworkError = class extends NHLError {
161
+ constructor(message, context = {}) {
162
+ super(message, ErrorCategory.NETWORK, context);
163
+ }
164
+ };
165
+ var ClientError = class extends NHLError {
166
+ constructor(message, context = {}) {
167
+ super(message, ErrorCategory.CLIENT, context);
168
+ }
169
+ };
170
+ var NotFoundError = class extends ClientError {
171
+ constructor(message = "Resource not found", context = {}) {
172
+ super(message, { ...context, statusCode: context.statusCode || 404 });
173
+ }
174
+ };
175
+ var ServerError = class extends NHLError {
176
+ constructor(message, context = {}) {
177
+ super(message, ErrorCategory.SERVER, context);
178
+ }
179
+ };
180
+ var RateLimitError = class extends NHLError {
181
+ retryAfter;
182
+ constructor(message = "Rate limit exceeded", context = {}, retryAfter) {
183
+ super(message, ErrorCategory.RATE_LIMIT, {
184
+ ...context,
185
+ statusCode: context.statusCode || 429
186
+ });
187
+ this.retryAfter = retryAfter || 0;
188
+ }
189
+ };
190
+ var APIError = class extends NHLError {
191
+ constructor(message, context = {}) {
192
+ super(message, ErrorCategory.API_ERROR, context);
193
+ }
194
+ };
195
+ var ValidationError = class extends NHLError {
196
+ constructor(message, context = {}) {
197
+ super(message, ErrorCategory.VALIDATION, context);
198
+ }
199
+ };
200
+ var ErrorHandler = class {
201
+ config;
202
+ constructor(config = {}) {
203
+ this.config = {
204
+ logLevel: config.logLevel ?? LogLevel.ERROR,
205
+ logger: config.logger ?? this.defaultLogger.bind(this),
206
+ includeStack: config.includeStack ?? true
207
+ };
208
+ }
209
+ /**
210
+ * Default console-based logger
211
+ */
212
+ defaultLogger(level, message, context) {
213
+ if (level > this.config.logLevel) return;
214
+ const logFn = level === LogLevel.ERROR ? console.error : level === LogLevel.WARN ? console.warn : console.log;
215
+ logFn(`[NHL API] ${message}`, context);
216
+ }
217
+ /**
218
+ * Log an error based on configuration
219
+ */
220
+ log(error) {
221
+ const level = this.getLogLevel(error.category);
222
+ const context = this.config.includeStack ? { ...error.context, stack: error.stack } : error.context;
223
+ this.config.logger(level, error.message, context);
224
+ }
225
+ /**
226
+ * Determine log level based on error category
227
+ */
228
+ getLogLevel(category) {
229
+ switch (category) {
230
+ case ErrorCategory.NETWORK:
231
+ case ErrorCategory.SERVER:
232
+ return LogLevel.ERROR;
233
+ case ErrorCategory.RATE_LIMIT:
234
+ return LogLevel.WARN;
235
+ case ErrorCategory.CLIENT:
236
+ case ErrorCategory.API_ERROR:
237
+ return LogLevel.INFO;
238
+ case ErrorCategory.PARSE:
239
+ case ErrorCategory.VALIDATION:
240
+ return LogLevel.DEBUG;
241
+ default:
242
+ return LogLevel.ERROR;
243
+ }
244
+ }
245
+ /**
246
+ * Create error from HTTP response
247
+ */
248
+ async fromResponse(response, context = {}) {
249
+ const statusCode = response.status;
250
+ const baseContext = {
251
+ ...context,
252
+ statusCode,
253
+ endpoint: context.endpoint || response.url
254
+ };
255
+ let responseBody;
256
+ try {
257
+ const text = await response.text();
258
+ responseBody = text ? JSON.parse(text) : null;
259
+ baseContext.responseBody = responseBody;
260
+ } catch {
261
+ }
262
+ const errorMessage = responseBody && typeof responseBody === "object" && "message" in responseBody ? String(responseBody.message) : `HTTP ${statusCode}: ${response.statusText}`;
263
+ if (statusCode === 429) {
264
+ const retryAfter = response.headers.get("Retry-After");
265
+ return new RateLimitError(
266
+ errorMessage,
267
+ baseContext,
268
+ retryAfter ? parseInt(retryAfter, 10) : void 0
269
+ );
270
+ }
271
+ if (statusCode === 404) {
272
+ return new NotFoundError(errorMessage, baseContext);
273
+ }
274
+ if (statusCode >= 500) {
275
+ return new ServerError(errorMessage, baseContext);
276
+ }
277
+ if (statusCode >= 400) {
278
+ return new ClientError(errorMessage, baseContext);
279
+ }
280
+ if (responseBody && typeof responseBody === "object" && "message" in responseBody) {
281
+ return new APIError(errorMessage, baseContext);
282
+ }
283
+ return new NHLError(errorMessage, ErrorCategory.CLIENT, baseContext);
284
+ }
285
+ /**
286
+ * Create error from caught exception
287
+ */
288
+ fromError(error, context = {}) {
289
+ if (error instanceof NHLError) {
290
+ return error;
291
+ }
292
+ if (error instanceof Error) {
293
+ if (error.name === "TypeError" || error.name === "NetworkError") {
294
+ return new NetworkError(error.message, {
295
+ ...context,
296
+ cause: error
297
+ });
298
+ }
299
+ return new NHLError(error.message, ErrorCategory.NETWORK, {
300
+ ...context,
301
+ cause: error
302
+ });
303
+ }
304
+ return new NHLError(
305
+ "An unknown error occurred",
306
+ ErrorCategory.NETWORK,
307
+ { ...context, cause: error }
308
+ );
309
+ }
310
+ /**
311
+ * Update configuration
312
+ */
313
+ configure(config) {
314
+ this.config = { ...this.config, ...config };
315
+ }
316
+ };
317
+ new ErrorHandler();
318
+
319
+ // src/client/types.ts
320
+ var API_BASE_URLS = {
321
+ "edge-adv": "https://api-web.nhle.com/v1",
322
+ "edge-stats": "https://api.nhle.com/stats/rest",
323
+ default: "https://api-web.nhle.com/v1"
324
+ };
325
+
326
+ // src/client/index.ts
327
+ var DEFAULT_CONFIG = {
328
+ baseUrl: "https://api-web.nhle.com/v1",
329
+ timeout: envConfig.timeout,
330
+ headers: {
331
+ Accept: "application/json"
332
+ },
333
+ language: envConfig.language
334
+ };
335
+ var NHLClient = class {
336
+ config;
337
+ errorHandler;
338
+ /**
339
+ * Creates a new NHL API client instance
340
+ * @param baseURL - Optional custom base URL or predefined API endpoint key
341
+ * @param errorConfig - Optional error handling configuration
342
+ */
343
+ constructor(baseURL, errorConfig) {
344
+ this.config = { ...DEFAULT_CONFIG };
345
+ if (baseURL && baseURL in API_BASE_URLS) {
346
+ this.config.baseUrl = API_BASE_URLS[baseURL];
347
+ } else if (baseURL) {
348
+ this.config.baseUrl = baseURL;
349
+ }
350
+ this.errorHandler = new ErrorHandler(errorConfig);
351
+ }
352
+ /**
353
+ * Helper to build URL with query parameters
354
+ * @private
355
+ */
356
+ buildUrl(endpoint, params) {
357
+ const cleanEndpoint = endpoint.startsWith("/") ? endpoint.slice(1) : endpoint;
358
+ const url = new URL(cleanEndpoint, `${this.config.baseUrl}/`);
359
+ if (params) {
360
+ Object.entries(params).forEach(([key, value]) => {
361
+ if (value !== void 0 && value !== null) {
362
+ url.searchParams.append(key, String(value));
363
+ }
364
+ });
365
+ }
366
+ return url.toString();
367
+ }
368
+ /**
369
+ * Send a GET request to the NHL API
370
+ * @param endpoint - API endpoint path
371
+ * @param params - Optional query parameters
372
+ * @returns Promise resolving to an APIResponse containing either data or error
373
+ */
374
+ async get(endpoint, params) {
375
+ const url = this.buildUrl(endpoint, params);
376
+ const controller = new AbortController();
377
+ const timeoutId = setTimeout(
378
+ () => controller.abort(),
379
+ this.config.timeout
380
+ );
381
+ try {
382
+ const response = await fetch(url, {
383
+ method: "GET",
384
+ headers: {
385
+ ...this.config.headers,
386
+ "Accept-Language": this.config.language
387
+ },
388
+ signal: controller.signal
389
+ });
390
+ clearTimeout(timeoutId);
391
+ if (!response.ok) {
392
+ const error = await this.errorHandler.fromResponse(response, {
393
+ endpoint: url
394
+ });
395
+ this.errorHandler.log(error);
396
+ return { status: "error", error };
397
+ }
398
+ return { data: await response.json(), status: "success" };
399
+ } catch (error) {
400
+ clearTimeout(timeoutId);
401
+ if (error instanceof NHLError) {
402
+ this.errorHandler.log(error);
403
+ return { status: "error", error };
404
+ }
405
+ let nhlError;
406
+ if (error instanceof Error && error.name === "AbortError") {
407
+ nhlError = new NHLError(
408
+ "Request timeout",
409
+ ErrorCategory.CLIENT,
410
+ {
411
+ endpoint
412
+ }
413
+ );
414
+ } else {
415
+ nhlError = this.errorHandler.fromError(error, {
416
+ endpoint,
417
+ method: "GET"
418
+ });
419
+ }
420
+ this.errorHandler.log(nhlError);
421
+ return { status: "error", error: nhlError };
422
+ }
423
+ }
424
+ /**
425
+ * Configure error handling behavior
426
+ * @param config - Error configuration options
427
+ */
428
+ configureErrorHandling(config) {
429
+ this.errorHandler.configure(config);
430
+ }
431
+ };
432
+ function createNHLClient(baseURL, errorConfig) {
433
+ return new NHLClient(baseURL, errorConfig);
434
+ }
435
+ var nhlClient = createNHLClient("default");
436
+ createNHLClient("edge-stats");
437
+ var client_default = nhlClient;
438
+
439
+ // src/utils/date.ts
440
+ var NHL_TIMEZONE = "America/New_York";
441
+ var getDate = (date) => new Intl.DateTimeFormat("en-CA", {
442
+ timeZone: NHL_TIMEZONE,
443
+ year: "numeric",
444
+ month: "2-digit",
445
+ day: "2-digit"
446
+ }).format(date);
447
+ var getCurrentDate = () => getDate(/* @__PURE__ */ new Date());
448
+ var getYear = (date) => new Intl.DateTimeFormat("en-CA", {
449
+ timeZone: NHL_TIMEZONE,
450
+ year: "numeric"
451
+ }).format(date);
452
+ var getCurrentYear = () => getYear(/* @__PURE__ */ new Date());
453
+ var getSeason = (date) => {
454
+ const format = new Intl.DateTimeFormat("en-CA", {
455
+ timeZone: NHL_TIMEZONE,
456
+ year: "numeric",
457
+ month: "numeric"
458
+ }).formatToParts(date instanceof Date ? date : new Date(date));
459
+ const month = format.find((part) => part.type === "month")?.value;
460
+ const year = format.find((part) => part.type === "year")?.value;
461
+ if (!year) {
462
+ throw new Error("Invalid date provided, could not extract year");
463
+ }
464
+ if (month && parseInt(month, 10) < 7) {
465
+ console.log(month, parseInt(month, 10) < 7);
466
+ return `${parseInt(year, 10) - 1}${year}`;
467
+ }
468
+ return `${year}${parseInt(year, 10) + 1}`;
469
+ };
470
+ var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
471
+
472
+ // src/constants/edge-adv.ts
473
+ var edge_adv_exports = {};
474
+ __export(edge_adv_exports, {
475
+ PositionFilterEnum: () => PositionFilterEnum,
476
+ SaveLocationCategoryEnum: () => SaveLocationCategoryEnum,
477
+ SaveLocationSortEnum: () => SaveLocationSortEnum,
478
+ SavePercentage5v5SortEnum: () => SavePercentage5v5SortEnum,
479
+ SavePercentageSortEnum: () => SavePercentageSortEnum,
480
+ ShotLocationCategoryEnum: () => ShotLocationCategoryEnum,
481
+ ShotLocationSortEnum: () => ShotLocationSortEnum,
482
+ ShotSpeedSortEnum: () => ShotSpeedSortEnum,
483
+ SkatersStrengthEnum: () => SkatersStrengthEnum,
484
+ SkatingDistanceSortEnum: () => SkatingDistanceSortEnum,
485
+ SkatingSpeedSortEnum: () => SkatingSpeedSortEnum,
486
+ ZoneTimeSortEnum: () => ZoneTimeSortEnum
487
+ });
488
+ var SaveLocationCategoryEnum = {
489
+ /** Save Percentage */
490
+ "SV%": "save-pctg",
491
+ /** Saves */
492
+ SV: "saves",
493
+ /** Shots Against */
494
+ SA: "shots-against",
495
+ /** Goals Against */
496
+ GA: "goals-against"
497
+ };
498
+ var ShotLocationSortEnum = {
499
+ /** All shot locations */
500
+ ALL: "all",
501
+ /** High-danger (i.e. close-range) shot locations */
502
+ HIGH: "high",
503
+ /** Mid-range shot locations */
504
+ MID: "mid",
505
+ /** Long-range shot locations */
506
+ LONG: "long"
507
+ };
508
+ var SaveLocationSortEnum = ShotLocationSortEnum;
509
+ var SavePercentage5v5SortEnum = {
510
+ /**5v5 Save %: The percentage of shots a goalie stops at even strength (5-on-5). */
511
+ "5v5-SV%": "save-pctg",
512
+ /**5v5 Save % in Close Situations: A “close situation” is the time during which a game is tied in the first or second period, or within one goal in the third period. This stats helps how goalies perform in high-pressure situations.*/
513
+ "5v5-SV%-Close": "save-pctg-close",
514
+ /**5v5 Shots Against: The total number of shots a goalie faces at even strength (5-on-5).*/
515
+ "5v5-SA": "shots",
516
+ /**5v5 Shots Against per 60 Minutes: The total number of shots a goalie faces at even strength (5-on-5) normalized to a 60-minute game. */
517
+ "5v5-SA/60": "shots-per-60"
518
+ };
519
+ var SavePercentageSortEnum = {
520
+ /** Starts above .900 */
521
+ GAMES: "games",
522
+ /** Percentage of starts above .900 */
523
+ PCTG: "pctg"
524
+ };
525
+ var PositionFilterEnum = {
526
+ /** Center */
527
+ ALL: "all",
528
+ /** Left Wing */
529
+ FWD: "forwards",
530
+ /** Right Wing */
531
+ DEF: "defense"
532
+ };
533
+ var SkatersStrengthEnum = {
534
+ /** All strengths */
535
+ ALL: "all",
536
+ /** Even strength */
537
+ ES: "es",
538
+ /** Power play */
539
+ PP: "pp",
540
+ /** Short-handed */
541
+ PK: "pk"
542
+ };
543
+ var ShotSpeedSortEnum = {
544
+ /** Hardest shot recorded by player */
545
+ MAX: "max",
546
+ /** Shots over 100 mph */
547
+ "OVER-100": "over-100",
548
+ /** Shots between 90 and 99 mph */
549
+ "90-99": "90-99",
550
+ /** Shots between 80 and 89 mph */
551
+ "80-89": "80-89",
552
+ /** Shots between 70 and 79 mph */
553
+ "70-79": "70-79"
554
+ };
555
+ var SkatingSpeedSortEnum = {
556
+ /** Fastest skating speed recorded by player */
557
+ TOP: "max",
558
+ /** Speed bursts recorded over 22 mph */
559
+ "OVER-22": "over-22",
560
+ /** Speed bursts recorded between 20 and 22 mph */
561
+ "20-22": "20-22",
562
+ /** Speed bursts recorded between 18 and 20 mph */
563
+ "18-20": "18-20"
564
+ };
565
+ var SkatingDistanceSortEnum = {
566
+ /** Total distance skated */
567
+ TOTAL: "total",
568
+ /** Average distance skated per 60 minutes */
569
+ "PER-60": "per-60",
570
+ /** Maximum distance skated in a single period */
571
+ "MAX-PERIOD": "max-period",
572
+ /** Maximum distance skated in a single game */
573
+ "MAX-GAME": "max-game"
574
+ };
575
+ var ShotLocationCategoryEnum = {
576
+ /** Total shots on goal */
577
+ SOG: "sog",
578
+ /** Total goals */
579
+ G: "goals",
580
+ /** Shooting percentage */
581
+ "SH%": "shooting-pctg"
582
+ };
583
+ var ZoneTimeSortEnum = {
584
+ /** Percentage of time spent in the offensive zone */
585
+ OZ: "offensive",
586
+ /** Percentage of time spent in the defensive zone */
587
+ DZ: "defensive",
588
+ /** Percentage of time spent in the neutral zone */
589
+ NZ: "neutral"
590
+ };
591
+
592
+ // src/constants/edge-stats.ts
593
+ var edge_stats_exports = {};
594
+
595
+ // src/constants/nhl.ts
596
+ var nhl_exports = {};
597
+ __export(nhl_exports, {
598
+ CURRENT: () => CURRENT,
599
+ END_SEASON: () => END_SEASON,
600
+ END_YEAR: () => END_YEAR,
601
+ GameStateEnum: () => GameStateEnum,
602
+ GameTypeEnum: () => GameTypeEnum,
603
+ InactiveTeamsEnum: () => InactiveTeamsEnum,
604
+ InactiveTeamsReverseEnum: () => InactiveTeamsReverseEnum,
605
+ PLAYER_ID_RANGE: () => PLAYER_ID_RANGE,
606
+ PeriodTypeEnum: () => PeriodTypeEnum,
607
+ PlayoffSeriesEnum: () => PlayoffSeriesEnum,
608
+ SEASON_RANGE: () => SEASON_RANGE,
609
+ START_SEASON: () => START_SEASON,
610
+ START_YEAR: () => START_YEAR,
611
+ SeasonsArray: () => SeasonsArray,
612
+ SeriesLetterByRound: () => SeriesLetterByRound,
613
+ SeriesLetterEnum: () => SeriesLetterEnum,
614
+ TEAM_ID_RANGE: () => TEAM_ID_RANGE,
615
+ TeamsEnum: () => TeamsEnum,
616
+ TeamsReverseEnum: () => TeamsReverseEnum,
617
+ YEAR_RANGE: () => YEAR_RANGE
618
+ });
619
+ var TeamsEnum = {
620
+ /** Anaheim Ducks */
621
+ ANA: 24,
622
+ /** Boston Bruins */
623
+ BOS: 6,
624
+ /** Buffalo Sabres */
625
+ BUF: 7,
626
+ /** Calgary Flames */
627
+ CGY: 20,
628
+ /** Carolina Hurricanes */
629
+ CAR: 12,
630
+ /** Chicago Blackhawks */
631
+ CHI: 16,
632
+ /** Colorado Avalanche */
633
+ COL: 21,
634
+ /** Columbus Blue Jackets */
635
+ CBJ: 29,
636
+ /** Dallas Stars */
637
+ DAL: 25,
638
+ /** Detroit Red Wings */
639
+ DET: 17,
640
+ /** Edmonton Oilers */
641
+ EDM: 22,
642
+ /** Florida Panthers */
643
+ FLA: 13,
644
+ /** Los Angeles Kings */
645
+ LAK: 26,
646
+ /** Minnesota Wild*/
647
+ MIN: 30,
648
+ /** Montreal Canadiens */
649
+ MTL: 8,
650
+ /** New Jersey Devils */
651
+ NJD: 1,
652
+ /** Nashville Predators */
653
+ NSH: 18,
654
+ /** New York Islanders */
655
+ NYI: 2,
656
+ /** New York Rangers */
657
+ NYR: 3,
658
+ /** Ottawa Senators */
659
+ OTT: 9,
660
+ /** Philadelphia Flyers */
661
+ PHI: 4,
662
+ /** Pittsburgh Penguins */
663
+ PIT: 5,
664
+ /** San Jose Sharks */
665
+ SJS: 28,
666
+ /** Seattle Kraken */
667
+ SEA: 55,
668
+ /** St. Louis Blues */
669
+ STL: 19,
670
+ /** Tampa Bay Lightning */
671
+ TBL: 14,
672
+ /** Toronto Maple Leafs */
673
+ TOR: 10,
674
+ /** Utah Hockey Club */
675
+ UTA: 59,
676
+ /** Vancouver Canucks */
677
+ VAN: 23,
678
+ /** Vegas Golden Knights */
679
+ VGK: 54,
680
+ /** Winnipeg Jets */
681
+ WPG: 52,
682
+ /** Washington Capitals */
683
+ WSH: 15
684
+ };
685
+ var TeamsReverseEnum = Object.fromEntries(
686
+ Object.entries(TeamsEnum).map(([key, value]) => [value, key])
687
+ );
688
+ var InactiveTeamsEnum = {
689
+ /** Atlanta Flames (not active) */
690
+ AFM: 47,
691
+ /** Arizona Coyotes (not active) */
692
+ ARI: 53,
693
+ /** Atlanta Thrashers (not active) */
694
+ ATL: 11,
695
+ /** Brooklyn Americans - (not active) */
696
+ BRK: 51,
697
+ /** California Golden Seals (aka Bay Area Seals) - (not active) */
698
+ CGS: 56,
699
+ /** Cleveland Barons - (not active) */
700
+ CLE: 49,
701
+ /** Colorado Rockies - (not active) */
702
+ CLR: 35,
703
+ /** Detroit Cougars - (not active) */
704
+ DCG: 40,
705
+ /** Detroit Falcons - (not active) */
706
+ DFL: 50,
707
+ /** Hamilton Tigers - (not active) */
708
+ HAM: 37,
709
+ /** Hartford Whalers - (not active) */
710
+ HFD: 34,
711
+ /** Kansas City Scouts - (not active) */
712
+ KCS: 48,
713
+ /** Montreal Maroons - (not active) */
714
+ MMR: 43,
715
+ /** Minnesota North Stars - (not active) */
716
+ MNS: 31,
717
+ /** Montreal Wanderers - (not active) */
718
+ MWN: 41,
719
+ /** New York Americans - (not active) */
720
+ NYA: 44,
721
+ /** California Seals (aka Oakland Seals) - (not active) */
722
+ OAK: 46,
723
+ /** Phoenix Coyotes - (not active) */
724
+ PHX: 27,
725
+ /** Pittsburgh Pirates - (not active) */
726
+ PIR: 38,
727
+ /** Quebec Bulldogs - (not active) */
728
+ QBD: 42,
729
+ /** Philadelphia Quakers - (not active) */
730
+ QUA: 39,
731
+ /** Quebec Nordiques - (not active) */
732
+ QUE: 32,
733
+ /** Ottawa Senators (original franchise) - (not active) */
734
+ SEN: 36,
735
+ /** St. Louis Eagles - (not active) */
736
+ SLE: 45,
737
+ /** Toronto Hockey Club (aka Toronto Arenas) - (not active) */
738
+ TAN: 57,
739
+ /** Toronto St. Patricks - (not active) */
740
+ TSP: 58,
741
+ /** Winnipeg Jets (original franchise) - (not active) */
742
+ WIN: 33
743
+ };
744
+ var InactiveTeamsReverseEnum = Object.fromEntries(
745
+ Object.entries(InactiveTeamsEnum).map(([key, value]) => [value, key])
746
+ );
747
+ var SeasonsArray = [
748
+ 19171918,
749
+ 19181919,
750
+ 19191920,
751
+ 19201921,
752
+ 19211922,
753
+ 19221923,
754
+ 19231924,
755
+ 19241925,
756
+ 19251926,
757
+ 19261927,
758
+ 19271928,
759
+ 19281929,
760
+ 19291930,
761
+ 19301931,
762
+ 19311932,
763
+ 19321933,
764
+ 19331934,
765
+ 19341935,
766
+ 19351936,
767
+ 19361937,
768
+ 19371938,
769
+ 19381939,
770
+ 19391940,
771
+ 19401941,
772
+ 19411942,
773
+ 19421943,
774
+ 19431944,
775
+ 19441945,
776
+ 19451946,
777
+ 19461947,
778
+ 19471948,
779
+ 19481949,
780
+ 19491950,
781
+ 19501951,
782
+ 19511952,
783
+ 19521953,
784
+ 19531954,
785
+ 19541955,
786
+ 19551956,
787
+ 19561957,
788
+ 19571958,
789
+ 19581959,
790
+ 19591960,
791
+ 19601961,
792
+ 19611962,
793
+ 19621963,
794
+ 19631964,
795
+ 19641965,
796
+ 19651966,
797
+ 19661967,
798
+ 19671968,
799
+ 19681969,
800
+ 19691970,
801
+ 19701971,
802
+ 19711972,
803
+ 19721973,
804
+ 19731974,
805
+ 19741975,
806
+ 19751976,
807
+ 19761977,
808
+ 19771978,
809
+ 19781979,
810
+ 19791980,
811
+ 19801981,
812
+ 19811982,
813
+ 19821983,
814
+ 19831984,
815
+ 19841985,
816
+ 19851986,
817
+ 19861987,
818
+ 19871988,
819
+ 19881989,
820
+ 19891990,
821
+ 19901991,
822
+ 19911992,
823
+ 19921993,
824
+ 19931994,
825
+ 19941995,
826
+ 19951996,
827
+ 19961997,
828
+ 19971998,
829
+ 19981999,
830
+ 19992e3,
831
+ 20002001,
832
+ 20012002,
833
+ 20022003,
834
+ 20032004,
835
+ 20052006,
836
+ 20062007,
837
+ 20072008,
838
+ 20082009,
839
+ 20092010,
840
+ 20102011,
841
+ 20112012,
842
+ 20122013,
843
+ 20132014,
844
+ 20142015,
845
+ 20152016,
846
+ 20162017,
847
+ 20172018,
848
+ 20182019,
849
+ 20192020,
850
+ 20202021,
851
+ 20212022,
852
+ 20222023,
853
+ 20232024,
854
+ 20242025,
855
+ 20252026
856
+ ];
857
+ var SeriesLetterEnum = {
858
+ /** Atlantic Division Round 1: D1 vs WC# */
859
+ A: "A",
860
+ /** Atlantic Division Round 1: D2 vs D3 */
861
+ B: "B",
862
+ /** Metropolitan Division Round 1: D1 vs WC# */
863
+ C: "C",
864
+ /** Metropolitan Division Round 1: D2 vs D3 */
865
+ D: "D",
866
+ /** Central Division Round 1: D1 vs WC# */
867
+ E: "E",
868
+ /** Central Division Round 1: D2 vs D3 */
869
+ F: "F",
870
+ /** Pacific Division Round 1: D1 vs WC# */
871
+ G: "G",
872
+ /** Pacific Division Round 1: D2 vs D3 */
873
+ H: "H",
874
+ /** Atlantic Division Round 2: Aw vs Bw */
875
+ I: "I",
876
+ /** Metropolitan Division Round 2: Cw vs Dw */
877
+ J: "J",
878
+ /** Central Division Round 2: Ew vs Fw */
879
+ K: "K",
880
+ /** Pacific Division Round 2: Gw vs Hw */
881
+ L: "L",
882
+ /** Eastern Conference Finals */
883
+ M: "M",
884
+ /** Western Conference Finals*/
885
+ N: "N",
886
+ /** Stanley Cup Finals */
887
+ O: "O"
888
+ };
889
+ var SeriesLetterByRound = {
890
+ R1: ["A", "B", "C", "D", "E", "F", "G", "H"],
891
+ R2: ["I", "J", "K", "L"],
892
+ CF: ["M", "N"],
893
+ SCF: ["O"]
894
+ };
895
+ var PlayoffSeriesEnum = {
896
+ Atlantic_R1_D1_vs_WC: "A",
897
+ Atlantic_R1_D2_vs_D3: "B",
898
+ Metropolitan_R1_D1_vs_WC: "C",
899
+ Metropolitan_R1_D2_vs_D3: "D",
900
+ Central_R1_D1_vs_WC: "E",
901
+ Central_R1_D2_vs_D3: "F",
902
+ Pacific_R1_D1_vs_WC: "G",
903
+ Pacific_R1_D2_vs_D3: "H",
904
+ Atlantic_R2_Aw_vs_Bw: "I",
905
+ Metropolitan_R2_Cw_vs_Dw: "J",
906
+ Central_R2_Ew_vs_Fw: "K",
907
+ Pacific_R2_Gw_vs_Hw: "L",
908
+ Eastern_Conference_Finals: "M",
909
+ Western_Conference_Finals: "N",
910
+ Stanley_Cup_Finals: "O"
911
+ };
912
+ var GameStateEnum = {
913
+ /** Future */
914
+ FUT: "FUT",
915
+ /** Live */
916
+ LIV: "LIV",
917
+ /** Finished */
918
+ FIN: "FIN"
919
+ };
920
+ var PeriodTypeEnum = {
921
+ /** Regulation */
922
+ REG: "REG",
923
+ /** Overtime */
924
+ OT: "OT",
925
+ /** Shootout */
926
+ SO: "SO"
927
+ };
928
+ var GameTypeEnum = {
929
+ /** Pre-season */
930
+ PRE: 1,
931
+ /** Regular season */
932
+ REG: 2,
933
+ /** Post-season (aka playoffs) */
934
+ POST: 3,
935
+ /** All-Star Game (unconfirmed) */
936
+ ASG: 4,
937
+ /** International (unconfirmed) */
938
+ INTL: 19
939
+ };
940
+ var SEASON_RANGE = {
941
+ START: SeasonsArray[0],
942
+ END: SeasonsArray.at(-1)
943
+ };
944
+ var START_SEASON = SEASON_RANGE.START;
945
+ var END_SEASON = SEASON_RANGE.END;
946
+ var YEAR_RANGE = {
947
+ START: parseInt(SEASON_RANGE.START.toString().slice(0, 4), 10),
948
+ END: parseInt(SEASON_RANGE.END.toString().slice(4, 8), 10)
949
+ };
950
+ var START_YEAR = YEAR_RANGE.START;
951
+ var END_YEAR = YEAR_RANGE.END;
952
+ var CURRENT = {
953
+ SEASON: SEASON_RANGE.END,
954
+ YEAR: YEAR_RANGE.END
955
+ };
956
+ var PLAYER_ID_RANGE = { MIN: 8444e3, MAX: 8489999 };
957
+ var TEAM_ID_RANGE = { MIN: 1, MAX: 59 };
958
+
959
+ // src/constants/index.ts
960
+ var EDGE = { ...edge_adv_exports, ...edge_stats_exports };
961
+
962
+ // src/utils/schemas.ts
963
+ function isParseError(value) {
964
+ return value instanceof arktype.type.errors;
965
+ }
966
+ var Year = arktype.type(`${nhl_exports.START_YEAR} <= number <= ${nhl_exports.END_YEAR}`).or(
967
+ arktype.type("string.numeric.parse").narrow((v) => {
968
+ return v >= nhl_exports.START_YEAR && v <= nhl_exports.END_YEAR;
969
+ })
970
+ ).describe(`a valid year from ${nhl_exports.START_YEAR} to ${nhl_exports.END_YEAR}`);
971
+ var Season = arktype.type("number.integer | string.numeric.parse").narrow((v) => {
972
+ const yr = Math.trunc(v / 1e4);
973
+ return typeof Year(yr) === "number" && yr + 1 === v % 1e4;
974
+ }).pipe((v) => v.toString()).describe(`a valid NHL season, e.g. ${nhl_exports.CURRENT.SEASON}`);
975
+ var TeamAbbrev = arktype.type.enumerated(
976
+ ...Object.keys(nhl_exports.TeamsEnum),
977
+ ...Object.keys(
978
+ nhl_exports.InactiveTeamsEnum
979
+ )
980
+ ).describe("a valid NHL team abbreviation");
981
+ var TeamId = arktype.type.enumerated(...Object.values(nhl_exports.TeamsEnum)).describe("a valid NHL team ID");
982
+ var GameType = arktype.type.enumerated(
983
+ ...Object.keys(
984
+ nhl_exports.GameTypeEnum
985
+ )
986
+ ).pipe((v) => nhl_exports.GameTypeEnum[v]).or(arktype.type('1|2|3|4|19|"1"|"2"|"3"|"4"|"19"')).describe("a valid NHL game type (e.g., REG, PRE, POST)");
987
+ var GameNumber = arktype.type("number").atLeast(1).atMost(82 * 32 / 2).or(
988
+ arktype.type("string.numeric.parse").narrow((v) => {
989
+ return v >= 1 && v <= 82 * 32 / 2;
990
+ })
991
+ ).pipe((v) => v.toString()).describe("a valid NHL game number between 1 and 1312");
992
+ var DraftRound = arktype.type("1 <= number <= 7").or(arktype.type(/^(1|2|3|4|5|6|7)$/)).pipe((v) => typeof v === "number" ? v.toString() : v).describe("a valid NHL draft round (1-7)");
993
+ arktype.type("1 <= number <= 4").or(arktype.type(/^(1|2|3|4)$/)).pipe((v) => typeof v === "number" ? v.toString() : v).describe("a valid NHL playoff round (1-4)");
994
+ var EventId = arktype.type("number.integer | string.numeric.parse").narrow((v) => Number.isInteger(v) && v > 0).describe("a positive integer representing an NHL event ID");
995
+ var NHLDate = arktype.type("Date | string.date.iso").pipe(
996
+ (v) => typeof v === "string" ? new Date(v).toISOString().slice(0, 10) : v.toISOString().slice(0, 10)
997
+ ).describe(
998
+ "a valid date, either as a string (ISO date string) or a Date object"
999
+ );
1000
+ arktype.type("Date | string").narrow((v) => {
1001
+ if (typeof v === "string") {
1002
+ return /^\d{4}-\d{2}$/.test(v);
1003
+ } else if (v instanceof Date) {
1004
+ return true;
1005
+ }
1006
+ return false;
1007
+ }).pipe((v) => typeof v === "string" ? v : v.toISOString().slice(0, 7)).describe(
1008
+ "a valid month, either as a string (formatted as YYYY-MM) or a Date object"
1009
+ );
1010
+ arktype.type("1|2|3|4|19").describe(
1011
+ "a valid NHL game type code (1=PRE, 2=REG, 3=POST, 4=ASG, 19=INTL)"
1012
+ );
1013
+ var parseGameIdParts = arktype.type({
1014
+ year: Year,
1015
+ gameType: GameType,
1016
+ gameNumber: GameNumber
1017
+ });
1018
+ var GameId = arktype.type("number.integer | string.numeric.parse").narrow((v) => {
1019
+ if (Number.isInteger(v) && v < 0) return false;
1020
+ const year = Math.trunc(v / 1e6);
1021
+ const gameType = Math.trunc(v / 1e4) % 100;
1022
+ const gameNumber = v % 1e4;
1023
+ const valid = !(parseGameIdParts({ year, gameType, gameNumber }) instanceof arktype.type.errors);
1024
+ return valid;
1025
+ }).describe("a positive integer representing an NHL game ID");
1026
+ var SeriesLetter = arktype.type.enumerated(...Object.values(nhl_exports.SeriesLetterEnum)).describe("a valid NHL playoff series letter (A-O)");
1027
+ arktype.type.enumerated(...Object.values(nhl_exports.GameStateEnum)).describe("a valid NHL game state");
1028
+ var CountryCode = arktype.type(/^[a-zA-Z]{2}$/).pipe((v) => v.toLowerCase()).describe("a valid ISO 3166-1 alpha-2 country code, e.g. US, CA, RU");
1029
+ var PostalCode = arktype.type(/^[a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d$/).or(arktype.type(/^\d{5}$/)).describe(
1030
+ "a valid postal code, either US ZIP code (5 digit) or Canadian postal code (A1A 1A1 format; space required)"
1031
+ );
1032
+ var PlayerId = arktype.type("number").atLeast(nhl_exports.PLAYER_ID_RANGE.MIN).atMost(nhl_exports.PLAYER_ID_RANGE.MAX).or(
1033
+ arktype.type("string.numeric.parse").narrow((v) => {
1034
+ return v >= nhl_exports.PLAYER_ID_RANGE.MIN && v <= nhl_exports.PLAYER_ID_RANGE.MAX;
1035
+ })
1036
+ ).pipe((v) => v.toString()).describe("a valid NHL player ID");
1037
+ arktype.type.enumerated(
1038
+ ...Object.keys(
1039
+ EDGE.SaveLocationCategoryEnum
1040
+ )
1041
+ ).pipe((v) => EDGE.SaveLocationCategoryEnum[v]);
1042
+ arktype.type.enumerated(
1043
+ ...Object.keys(
1044
+ EDGE.ShotLocationSortEnum
1045
+ )
1046
+ ).pipe((v) => EDGE.ShotLocationSortEnum[v]);
1047
+ arktype.type.enumerated(
1048
+ ...Object.keys(
1049
+ EDGE.SaveLocationSortEnum
1050
+ )
1051
+ ).pipe((v) => EDGE.SaveLocationSortEnum[v]);
1052
+ arktype.type.enumerated(
1053
+ ...Object.keys(
1054
+ EDGE.SavePercentage5v5SortEnum
1055
+ )
1056
+ ).pipe((v) => EDGE.SavePercentage5v5SortEnum[v]);
1057
+ arktype.type.enumerated(
1058
+ ...Object.keys(
1059
+ EDGE.SavePercentageSortEnum
1060
+ )
1061
+ ).pipe((v) => EDGE.SavePercentageSortEnum[v]);
1062
+ var PositionFilter = arktype.type.enumerated(
1063
+ ...Object.keys(
1064
+ EDGE.PositionFilterEnum
1065
+ )
1066
+ ).pipe((v) => EDGE.PositionFilterEnum[v]);
1067
+ var SkatersStrength = arktype.type.enumerated(
1068
+ ...Object.keys(
1069
+ EDGE.SkatersStrengthEnum
1070
+ )
1071
+ ).pipe((v) => EDGE.SkatersStrengthEnum[v]);
1072
+ arktype.type.enumerated(
1073
+ ...Object.keys(
1074
+ EDGE.ShotSpeedSortEnum
1075
+ )
1076
+ ).pipe((v) => EDGE.ShotSpeedSortEnum[v]);
1077
+ arktype.type.enumerated(
1078
+ ...Object.keys(
1079
+ EDGE.SkatingSpeedSortEnum
1080
+ )
1081
+ ).pipe((v) => EDGE.SkatingSpeedSortEnum[v]);
1082
+ arktype.type.enumerated(
1083
+ ...Object.keys(
1084
+ EDGE.SkatingDistanceSortEnum
1085
+ )
1086
+ );
1087
+ arktype.type.enumerated(
1088
+ ...Object.keys(
1089
+ EDGE.ShotLocationCategoryEnum
1090
+ )
1091
+ ).pipe((v) => EDGE.ShotLocationCategoryEnum[v]);
1092
+ arktype.type.enumerated(
1093
+ ...Object.keys(
1094
+ EDGE.ZoneTimeSortEnum
1095
+ )
1096
+ ).pipe((v) => EDGE.ZoneTimeSortEnum[v]);
1097
+ var BaseParams = arktype.type({
1098
+ season: Season.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.SEASON),
1099
+ gameType: GameType.or("undefined").pipe(
1100
+ (v) => v ?? nhl_exports.GameTypeEnum.REG
1101
+ )
1102
+ });
1103
+ arktype.type({
1104
+ season: Season.or("undefined").optional(),
1105
+ gameType: GameType.or("undefined").optional()
1106
+ });
1107
+ BaseParams.merge({
1108
+ playerId: PlayerId,
1109
+ season: Season
1110
+ });
1111
+ BaseParams.merge({
1112
+ teamId: TeamId
1113
+ });
1114
+ BaseParams.merge({
1115
+ position: PositionFilter.default("ALL"),
1116
+ strength: SkatersStrength.default("ALL")
1117
+ });
1118
+ var DraftParams = arktype.type({
1119
+ year: Year.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.YEAR),
1120
+ round: DraftRound.or("undefined").optional()
1121
+ });
1122
+ var GameIdAndEventId = arktype.type({
1123
+ gameId: GameId,
1124
+ eventId: EventId
1125
+ });
1126
+ var TeamAndSeasonParams = arktype.type({
1127
+ team: TeamAbbrev,
1128
+ season: Season.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.SEASON)
1129
+ });
1130
+ var SeriesAndSeasonParams = arktype.type({
1131
+ seriesLetter: SeriesLetter,
1132
+ season: Season.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.SEASON)
1133
+ });
1134
+ var SeriesParams = arktype.type({
1135
+ seriesLetter: SeriesLetter,
1136
+ year: Year.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.YEAR)
1137
+ });
1138
+ var ScheduleParams = arktype.type({
1139
+ team: TeamAbbrev,
1140
+ date: NHLDate.or("undefined").pipe((v) => v ?? getCurrentDate()),
1141
+ period: arktype.type('"week" | "month" | undefined').pipe((v) => v ?? "week")
1142
+ });
1143
+
1144
+ // src/utils/utils.ts
1145
+ function route(template, params) {
1146
+ let route2 = template;
1147
+ for (const [key, value] of Object.entries(params)) {
1148
+ if (value === void 0) continue;
1149
+ route2 = route2.replace(`{${key}}`, String(value));
1150
+ }
1151
+ return route2;
1152
+ }
1153
+
1154
+ // src/api/gamecenter/draft.ts
1155
+ var _paths = {
1156
+ draftPicks: {
1157
+ byYearAndRound: "draft/picks/{year}/{round}",
1158
+ byYear: "draft/picks/{year}/all"
1159
+ },
1160
+ draftRankings: "draft/rankings/{year}/{type}",
1161
+ draftTracker: "draft-tracker/picks/now"
1162
+ };
1163
+ var DraftRankingsEnum = {
1164
+ skatersNA: "1",
1165
+ skatersIntl: "2",
1166
+ goaliesNA: "3",
1167
+ goaliesIntl: "4"
1168
+ };
1169
+ var picks = (year, round) => {
1170
+ const parsed = DraftParams({ year, round });
1171
+ if (isParseError(parsed)) {
1172
+ return Promise.resolve({
1173
+ status: "error",
1174
+ error: new ValidationError(parsed.summary, {
1175
+ endpoint: _paths.draftPicks.byYearAndRound
1176
+ })
1177
+ });
1178
+ }
1179
+ if (parsed.year && !parsed.round)
1180
+ return client_default.get(route(_paths.draftPicks.byYear, parsed));
1181
+ return client_default.get(route(_paths.draftPicks.byYearAndRound, parsed));
1182
+ };
1183
+ var tracker = () => client_default.get(_paths.draftTracker);
1184
+ var rankings = (year) => {
1185
+ const getRankings = (type2) => {
1186
+ const parsedYear = Year(year ?? getCurrentYear());
1187
+ if (isParseError(parsedYear)) {
1188
+ return Promise.resolve({
1189
+ status: "error",
1190
+ error: new ValidationError(parsedYear.summary, {
1191
+ endpoint: _paths.draftRankings
1192
+ })
1193
+ });
1194
+ }
1195
+ return client_default.get(
1196
+ route(_paths.draftRankings, {
1197
+ year: parsedYear,
1198
+ type: type2
1199
+ })
1200
+ );
1201
+ };
1202
+ return {
1203
+ skatersNA: () => getRankings(DraftRankingsEnum.skatersNA),
1204
+ skatersIntl: () => getRankings(DraftRankingsEnum.skatersIntl),
1205
+ goaliesNA: () => getRankings(DraftRankingsEnum.goaliesNA),
1206
+ goaliesIntl: () => getRankings(DraftRankingsEnum.goaliesIntl),
1207
+ all: () => Promise.all([
1208
+ getRankings(DraftRankingsEnum.skatersNA),
1209
+ getRankings(DraftRankingsEnum.skatersIntl),
1210
+ getRankings(DraftRankingsEnum.goaliesNA),
1211
+ getRankings(DraftRankingsEnum.goaliesIntl)
1212
+ ])
1213
+ };
1214
+ };
1215
+
1216
+ // src/api/gamecenter/game.ts
1217
+ var game_exports = {};
1218
+ __export(game_exports, {
1219
+ boxscore: () => boxscore,
1220
+ landing: () => landing,
1221
+ networkTVSchedule: () => networkTVSchedule,
1222
+ playByPlay: () => playByPlay,
1223
+ playoffBracket: () => playoffBracket,
1224
+ playoffSeries: () => playoffSeries,
1225
+ playoffSeriesSchedule: () => playoffSeriesSchedule,
1226
+ pptReplay: () => pptReplay,
1227
+ reports: () => reports,
1228
+ schedule: () => schedule,
1229
+ scheduleCalendar: () => scheduleCalendar,
1230
+ whereToWatch: () => whereToWatch,
1231
+ wsc: () => wsc
1232
+ });
1233
+ var _paths2 = {
1234
+ schedule: "schedule/{date}",
1235
+ scheduleCalendar: "schedule-calendar/{date}",
1236
+ playoffBracket: "playoff-bracket/{year}",
1237
+ playoffSeries: "playoff-series/{season}",
1238
+ playoffSeriesSchedule: "schedule/playoff-series/{season}/{seriesLetter}",
1239
+ gamecenter: {
1240
+ playByPlay: "gamecenter/{gameId}/play-by-play",
1241
+ reports: "gamecenter/{gameId}/right-rail",
1242
+ landing: "gamecenter/{gameId}/landing",
1243
+ boxscore: "gamecenter/{gameId}/boxscore"
1244
+ },
1245
+ wsc: {
1246
+ gameStory: "wsc/game-story/{gameId}",
1247
+ playByPlay: "wsc/play-by-play/{gameId}"
1248
+ },
1249
+ pptReplay: {
1250
+ goal: "ppt-replay/{gameId}/goal/{eventId}",
1251
+ event: "ppt-replay/{date}"
1252
+ },
1253
+ whereToWatch: "where-to-watch",
1254
+ networkTVSchedule: "network/tv-schedule/{date}"
1255
+ };
1256
+ var playByPlay = (gameId) => {
1257
+ const parsedGameId = GameId(gameId);
1258
+ if (isParseError(parsedGameId)) {
1259
+ return Promise.resolve({
1260
+ status: "error",
1261
+ error: new ValidationError(parsedGameId.summary, {
1262
+ endpoint: _paths2.gamecenter.playByPlay
1263
+ })
1264
+ });
1265
+ }
1266
+ return client_default.get(
1267
+ route(_paths2.gamecenter.playByPlay, { gameId: parsedGameId })
1268
+ );
1269
+ };
1270
+ var reports = (gameId) => {
1271
+ const parsedGameId = GameId(gameId);
1272
+ if (isParseError(parsedGameId)) {
1273
+ return Promise.resolve({
1274
+ status: "error",
1275
+ error: new ValidationError(parsedGameId.summary, {
1276
+ endpoint: _paths2.gamecenter.reports
1277
+ })
1278
+ });
1279
+ }
1280
+ return client_default.get(
1281
+ route(_paths2.gamecenter.reports, { gameId: parsedGameId })
1282
+ );
1283
+ };
1284
+ var landing = (gameId) => {
1285
+ const parsedGameId = GameId(gameId);
1286
+ if (isParseError(parsedGameId)) {
1287
+ return Promise.resolve({
1288
+ status: "error",
1289
+ error: new ValidationError(parsedGameId.summary, {
1290
+ endpoint: _paths2.gamecenter.landing
1291
+ })
1292
+ });
1293
+ }
1294
+ return client_default.get(
1295
+ route(_paths2.gamecenter.landing, { gameId: parsedGameId })
1296
+ );
1297
+ };
1298
+ var boxscore = (gameId) => {
1299
+ const parsedGameId = GameId(gameId);
1300
+ if (isParseError(parsedGameId)) {
1301
+ return Promise.resolve({
1302
+ status: "error",
1303
+ error: new ValidationError(parsedGameId.summary, {
1304
+ endpoint: _paths2.gamecenter.boxscore
1305
+ })
1306
+ });
1307
+ }
1308
+ return client_default.get(
1309
+ route(_paths2.gamecenter.boxscore, { gameId: parsedGameId })
1310
+ );
1311
+ };
1312
+ var wsc = {
1313
+ /**
1314
+ * Get game story data for a specific game
1315
+ * @param gameId - The unique identifier for the game
1316
+ * @returns Promise resolving to game story data
1317
+ */
1318
+ gameStory: (gameId) => {
1319
+ const parsedGameId = GameId(gameId);
1320
+ if (isParseError(parsedGameId)) {
1321
+ return Promise.resolve({
1322
+ status: "error",
1323
+ error: new ValidationError(parsedGameId.summary, {
1324
+ endpoint: _paths2.wsc.gameStory
1325
+ })
1326
+ });
1327
+ }
1328
+ return client_default.get(
1329
+ route(_paths2.wsc.gameStory, { gameId: parsedGameId })
1330
+ );
1331
+ },
1332
+ /**
1333
+ * Get play-by-play data for a specific game
1334
+ * @param gameId - The unique identifier for the game
1335
+ * @returns Promise resolving to play-by-play data
1336
+ */
1337
+ playByPlay: (gameId) => {
1338
+ const parsedGameId = GameId(gameId);
1339
+ if (isParseError(parsedGameId)) {
1340
+ return Promise.resolve({
1341
+ status: "error",
1342
+ error: new ValidationError(parsedGameId.summary, {
1343
+ endpoint: _paths2.wsc.playByPlay
1344
+ })
1345
+ });
1346
+ }
1347
+ return client_default.get(
1348
+ route(_paths2.wsc.playByPlay, { gameId: parsedGameId })
1349
+ );
1350
+ }
1351
+ };
1352
+ var pptReplay = {
1353
+ /**
1354
+ * Get goal replay data for a specific game and event
1355
+ * @param gameId - The unique identifier for the game
1356
+ * @param eventId - The unique identifier for the event
1357
+ * @returns Promise resolving to goal replay data
1358
+ */
1359
+ goal: (gameId, eventId) => {
1360
+ const parsed = GameIdAndEventId({ gameId, eventId });
1361
+ if (isParseError(parsed)) {
1362
+ return Promise.resolve({
1363
+ status: "error",
1364
+ error: new ValidationError(parsed.summary, {
1365
+ endpoint: _paths2.pptReplay.goal
1366
+ })
1367
+ });
1368
+ }
1369
+ return client_default.get(
1370
+ route(_paths2.pptReplay.goal, { gameId, eventId })
1371
+ );
1372
+ },
1373
+ /**
1374
+ * Get event replay data for a specific date
1375
+ * @param date - Date to get event replay data for (Date object or ISO date string)
1376
+ * @returns Promise resolving to event replay data
1377
+ */
1378
+ event: async (date) => {
1379
+ const parsedDate = NHLDate(date);
1380
+ if (isParseError(parsedDate)) {
1381
+ return Promise.resolve({
1382
+ status: "error",
1383
+ error: new ValidationError(parsedDate.summary, {
1384
+ endpoint: _paths2.pptReplay.event
1385
+ })
1386
+ });
1387
+ }
1388
+ return client_default.get(
1389
+ route(_paths2.pptReplay.event, { date: parsedDate })
1390
+ );
1391
+ }
1392
+ };
1393
+ var schedule = (date) => {
1394
+ const parsedDate = NHLDate(date ?? getCurrentDate());
1395
+ if (isParseError(parsedDate)) {
1396
+ return Promise.resolve({
1397
+ status: "error",
1398
+ error: new ValidationError(parsedDate.summary, {
1399
+ endpoint: _paths2.schedule
1400
+ })
1401
+ });
1402
+ }
1403
+ return client_default.get(route(_paths2.schedule, { date: parsedDate }));
1404
+ };
1405
+ var scheduleCalendar = (date) => {
1406
+ const parsedDate = NHLDate(date);
1407
+ if (isParseError(parsedDate)) {
1408
+ return Promise.resolve({
1409
+ status: "error",
1410
+ error: new ValidationError(parsedDate.summary, {
1411
+ endpoint: _paths2.scheduleCalendar
1412
+ })
1413
+ });
1414
+ }
1415
+ return client_default.get(
1416
+ route(_paths2.scheduleCalendar, { date: parsedDate })
1417
+ );
1418
+ };
1419
+ var playoffBracket = (year) => {
1420
+ const parsedYear = Year(year ?? getCurrentYear());
1421
+ if (isParseError(parsedYear)) {
1422
+ return Promise.resolve({
1423
+ status: "error",
1424
+ error: new ValidationError(parsedYear.summary, {
1425
+ endpoint: _paths2.playoffBracket
1426
+ })
1427
+ });
1428
+ }
1429
+ return client_default.get(route(_paths2.playoffBracket, { year: parsedYear }));
1430
+ };
1431
+ var playoffSeries = (season) => {
1432
+ const parsedSeason = Season(season ?? getCurrentSeason());
1433
+ if (isParseError(parsedSeason)) {
1434
+ return Promise.resolve({
1435
+ status: "error",
1436
+ error: new ValidationError(parsedSeason.summary, {
1437
+ endpoint: _paths2.playoffSeries
1438
+ })
1439
+ });
1440
+ }
1441
+ return client_default.get(
1442
+ route(_paths2.playoffSeries, { season: parsedSeason })
1443
+ );
1444
+ };
1445
+ var playoffSeriesSchedule = (seriesLetter, season) => {
1446
+ const parsed = SeriesAndSeasonParams({
1447
+ seriesLetter,
1448
+ season: season ?? getCurrentSeason()
1449
+ });
1450
+ if (isParseError(parsed)) {
1451
+ return Promise.resolve({
1452
+ status: "error",
1453
+ error: new ValidationError(parsed.summary, {
1454
+ endpoint: _paths2.playoffSeriesSchedule
1455
+ })
1456
+ });
1457
+ }
1458
+ return client_default.get(route(_paths2.playoffSeriesSchedule, parsed));
1459
+ };
1460
+ var whereToWatch = () => client_default.get(_paths2.whereToWatch);
1461
+ var networkTVSchedule = (date) => {
1462
+ const parsedDate = NHLDate(date ?? getCurrentDate());
1463
+ if (isParseError(parsedDate)) {
1464
+ return Promise.resolve({
1465
+ status: "error",
1466
+ error: new ValidationError(parsedDate.summary, {
1467
+ endpoint: _paths2.networkTVSchedule
1468
+ })
1469
+ });
1470
+ }
1471
+ return client_default.get(
1472
+ route(_paths2.networkTVSchedule, { date: parsedDate })
1473
+ );
1474
+ };
1475
+
1476
+ // src/api/gamecenter/misc.ts
1477
+ var misc_exports = {};
1478
+ __export(misc_exports, {
1479
+ location: () => location,
1480
+ meta: () => meta,
1481
+ partnerGame: () => partnerGame,
1482
+ postalLookup: () => postalLookup,
1483
+ seasons: () => seasons
1484
+ });
1485
+ var _paths3 = {
1486
+ season: "season",
1487
+ metaPlayoffSeries: "meta/playoff-series/{year}/{seriesLetter}",
1488
+ metaGame: "meta/game/{gameId}",
1489
+ postalLookup: "postal-lookup/{postalCode}",
1490
+ location: "location",
1491
+ partnerGame: "partner-game/{countryCode}/now"
1492
+ };
1493
+ var seasons = () => {
1494
+ return client_default.get(_paths3.season);
1495
+ };
1496
+ var meta = {
1497
+ /**
1498
+ * Get meta information for a playoff series
1499
+ *
1500
+ * @param year - The year in YYYY format
1501
+ * @param seriesLetter - Single letter identifier for the playoff series
1502
+ * @returns Promise resolving to playoff series meta information
1503
+ */
1504
+ playoffSeries: (seriesLetter, year) => {
1505
+ const parsed = SeriesParams({ year, seriesLetter });
1506
+ if (isParseError(parsed)) {
1507
+ return Promise.resolve({
1508
+ status: "error",
1509
+ error: new ValidationError(parsed.summary, {
1510
+ endpoint: _paths3.metaPlayoffSeries
1511
+ })
1512
+ });
1513
+ }
1514
+ return client_default.get(route(_paths3.metaPlayoffSeries, parsed));
1515
+ },
1516
+ /**
1517
+ * Get meta information for a specific game
1518
+ *
1519
+ * @param gameId - The unique game identifier
1520
+ * @returns Promise resolving to game meta information
1521
+ */
1522
+ game: (gameId) => {
1523
+ const parsedGameId = GameId(gameId);
1524
+ if (isParseError(parsedGameId)) {
1525
+ return Promise.resolve({
1526
+ status: "error",
1527
+ error: new ValidationError(parsedGameId.summary, {
1528
+ endpoint: _paths3.metaGame
1529
+ })
1530
+ });
1531
+ }
1532
+ return client_default.get(
1533
+ route(_paths3.metaGame, { gameId: parsedGameId })
1534
+ );
1535
+ }
1536
+ };
1537
+ var postalLookup = (postalCode) => {
1538
+ const parsedPostalCode = PostalCode(postalCode);
1539
+ if (isParseError(parsedPostalCode)) {
1540
+ return Promise.resolve({
1541
+ status: "error",
1542
+ error: new ValidationError(parsedPostalCode.summary, {
1543
+ endpoint: _paths3.postalLookup
1544
+ })
1545
+ });
1546
+ }
1547
+ return client_default.get(
1548
+ route(_paths3.postalLookup, { postalCode: parsedPostalCode })
1549
+ );
1550
+ };
1551
+ var location = () => {
1552
+ return client_default.get(_paths3.location);
1553
+ };
1554
+ var partnerGame = (countryCode) => {
1555
+ const parsedCountryCode = CountryCode(countryCode);
1556
+ if (isParseError(parsedCountryCode)) {
1557
+ return Promise.resolve({
1558
+ status: "error",
1559
+ error: new ValidationError(parsedCountryCode.summary, {
1560
+ endpoint: _paths3.partnerGame
1561
+ })
1562
+ });
1563
+ }
1564
+ return client_default.get(
1565
+ route(_paths3.partnerGame, { countryCode: parsedCountryCode })
1566
+ );
1567
+ };
1568
+
1569
+ // src/api/gamecenter/player.ts
1570
+ var player_exports = {};
1571
+ __export(player_exports, {
1572
+ gameLog: () => gameLog,
1573
+ landing: () => landing2,
1574
+ search: () => search,
1575
+ spotlight: () => spotlight,
1576
+ statsLeaders: () => statsLeaders
1577
+ });
1578
+ var _paths4 = {
1579
+ landing: "player/{playerId}/landing",
1580
+ gameLog: "player/{playerId}/game-log/{season}/{gameType}",
1581
+ spotlight: "player-spotlight",
1582
+ statsLeaders: {
1583
+ skaters: "skater-stats-leaders/{season}/{gameType}",
1584
+ goalies: "goalie-stats-leaders/{season}/{gameType}"
1585
+ },
1586
+ playerSearch: "https://search.d3.nhle.com/api/v1/search/player"
1587
+ };
1588
+ var nhlPlayerSearch = createNHLClient(_paths4.playerSearch);
1589
+ var searchUrlParams = { culture: "en", q: "" };
1590
+ var landing2 = (playerId) => {
1591
+ const parsedPlayerId = PlayerId(playerId);
1592
+ if (isParseError(parsedPlayerId)) {
1593
+ return Promise.resolve({
1594
+ status: "error",
1595
+ error: new ValidationError(parsedPlayerId.summary, {
1596
+ endpoint: _paths4.landing
1597
+ })
1598
+ });
1599
+ }
1600
+ return client_default.get(
1601
+ route(_paths4.landing, { playerId: parsedPlayerId })
1602
+ );
1603
+ };
1604
+ var gameLog = (playerId, season, gameType) => {
1605
+ const Parser = BaseParams.merge({
1606
+ playerId: PlayerId
1607
+ });
1608
+ const parsed = Parser({ playerId, season, gameType });
1609
+ if (isParseError(parsed)) {
1610
+ return Promise.resolve({
1611
+ status: "error",
1612
+ error: new ValidationError(parsed.summary, {
1613
+ endpoint: _paths4.gameLog
1614
+ })
1615
+ });
1616
+ }
1617
+ return client_default.get(route(_paths4.gameLog, parsed));
1618
+ };
1619
+ var spotlight = () => {
1620
+ return client_default.get(_paths4.spotlight);
1621
+ };
1622
+ var search = (query) => {
1623
+ return nhlPlayerSearch.get("", {
1624
+ ...searchUrlParams,
1625
+ q: query
1626
+ });
1627
+ };
1628
+ var statsLeaders = {
1629
+ /**
1630
+ * Get skater stats leaders
1631
+ * @param season - The season identifier (optional)
1632
+ * @param gameType - The game type identifier (optional)
1633
+ * @returns Promise resolving to skater stats leaders
1634
+ */
1635
+ skaters: (season, gameType) => {
1636
+ const parsed = BaseParams({ season, gameType });
1637
+ if (isParseError(parsed)) {
1638
+ return Promise.resolve({
1639
+ status: "error",
1640
+ error: new ValidationError(parsed.summary, {
1641
+ endpoint: _paths4.statsLeaders.skaters
1642
+ })
1643
+ });
1644
+ }
1645
+ return client_default.get(route(_paths4.statsLeaders.skaters, parsed));
1646
+ },
1647
+ /**
1648
+ * Get goalie stats leaders
1649
+ * @param season - The season identifier (optional)
1650
+ * @param gameType - The game type identifier (optional)
1651
+ * @returns Promise resolving to goalie stats leaders
1652
+ */
1653
+ goalies: (season, gameType) => {
1654
+ const parsed = BaseParams({ season, gameType });
1655
+ if (isParseError(parsed)) {
1656
+ return Promise.resolve({
1657
+ status: "error",
1658
+ error: new ValidationError(parsed.summary, {
1659
+ endpoint: _paths4.statsLeaders.goalies
1660
+ })
1661
+ });
1662
+ }
1663
+ return client_default.get(route(_paths4.statsLeaders.goalies, parsed));
1664
+ }
1665
+ };
1666
+
1667
+ // src/api/gamecenter/score.ts
1668
+ var _paths5 = {
1669
+ score: "score/{date}",
1670
+ scoreboard: {
1671
+ now: "scoreboard/now",
1672
+ byTeam: "scoreboard/{team}/now",
1673
+ byDate: "scoreboard/{date}"
1674
+ }
1675
+ };
1676
+ var score = (date) => {
1677
+ const parsed = NHLDate(date ?? getCurrentDate());
1678
+ if (isParseError(parsed)) {
1679
+ return Promise.resolve({
1680
+ status: "error",
1681
+ error: new ValidationError(parsed.summary, {
1682
+ endpoint: _paths5.score
1683
+ })
1684
+ });
1685
+ }
1686
+ return client_default.get(route(_paths5.score, { date: parsed }));
1687
+ };
1688
+ var scoreboard = () => client_default.get(_paths5.scoreboard.now);
1689
+ scoreboard.team = async (team) => {
1690
+ const parsed = TeamAbbrev(team);
1691
+ if (isParseError(parsed)) {
1692
+ return Promise.resolve({
1693
+ status: "error",
1694
+ error: new ValidationError(parsed.summary, {
1695
+ endpoint: _paths5.scoreboard.byTeam
1696
+ })
1697
+ });
1698
+ }
1699
+ return client_default.get(
1700
+ route(_paths5.scoreboard.byTeam, { team: parsed })
1701
+ );
1702
+ };
1703
+ scoreboard.date = async (date) => {
1704
+ const parsed = NHLDate(date);
1705
+ if (isParseError(parsed)) {
1706
+ return Promise.resolve({
1707
+ status: "error",
1708
+ error: new ValidationError(parsed.summary, {
1709
+ endpoint: _paths5.scoreboard.byDate
1710
+ })
1711
+ });
1712
+ }
1713
+ return client_default.get(
1714
+ route(_paths5.scoreboard.byDate, { date: parsed })
1715
+ );
1716
+ };
1717
+
1718
+ // src/api/gamecenter/team.ts
1719
+ var team_exports = {};
1720
+ __export(team_exports, {
1721
+ clubStats: () => clubStats,
1722
+ clubStatsSeason: () => clubStatsSeason,
1723
+ prospects: () => prospects,
1724
+ roster: () => roster,
1725
+ rosterSeasons: () => rosterSeasons,
1726
+ schedule: () => schedule2,
1727
+ standings: () => standings,
1728
+ standingsSeason: () => standingsSeason
1729
+ });
1730
+ var paths = {
1731
+ rosterSeasons: "roster-season/{team}",
1732
+ roster: "roster/{team}/{season}",
1733
+ prospects: "prospects/{team}",
1734
+ clubStats: "club-stats/{team}/{season}/{gameType}",
1735
+ clubStatsSeason: "club-stats-season/{team}",
1736
+ standings: "standings/{date}",
1737
+ standingsSeason: "standings-season",
1738
+ clubSchedule: "club-schedule/{team}/{period}/{date}",
1739
+ clubScheduleSeason: "club-schedule-season/{team}/{season}"
1740
+ };
1741
+ var rosterSeasons = (team) => {
1742
+ const parsed = TeamAbbrev(team);
1743
+ if (isParseError(parsed)) {
1744
+ return Promise.resolve({
1745
+ status: "error",
1746
+ error: new ValidationError(parsed.summary, {
1747
+ endpoint: paths.rosterSeasons
1748
+ })
1749
+ });
1750
+ }
1751
+ return client_default.get(route(paths.rosterSeasons, { team: parsed }));
1752
+ };
1753
+ var roster = (team, season) => {
1754
+ const parsed = TeamAndSeasonParams({ team, season });
1755
+ if (isParseError(parsed)) {
1756
+ return Promise.resolve({
1757
+ status: "error",
1758
+ error: new ValidationError(parsed.summary, {
1759
+ endpoint: paths.roster
1760
+ })
1761
+ });
1762
+ }
1763
+ return client_default.get(route(paths.roster, parsed));
1764
+ };
1765
+ var prospects = (team) => {
1766
+ const parsed = TeamAbbrev(team);
1767
+ if (isParseError(parsed)) {
1768
+ return Promise.resolve({
1769
+ status: "error",
1770
+ error: new ValidationError(parsed.summary, {
1771
+ endpoint: paths.prospects
1772
+ })
1773
+ });
1774
+ }
1775
+ return client_default.get(route(paths.prospects, { team: parsed }));
1776
+ };
1777
+ var clubStats = (team, season, gameType) => {
1778
+ const Parser = BaseParams.merge({
1779
+ team: TeamAbbrev
1780
+ });
1781
+ const parsed = Parser({ team, season, gameType });
1782
+ if (isParseError(parsed)) {
1783
+ return Promise.resolve({
1784
+ status: "error",
1785
+ error: new ValidationError(parsed.summary, {
1786
+ endpoint: paths.clubStats
1787
+ })
1788
+ });
1789
+ }
1790
+ return client_default.get(route(paths.clubStats, parsed));
1791
+ };
1792
+ var clubStatsSeason = (team) => {
1793
+ const parsed = TeamAbbrev(team);
1794
+ if (isParseError(parsed)) {
1795
+ return Promise.resolve({
1796
+ status: "error",
1797
+ error: new ValidationError(parsed.summary, {
1798
+ endpoint: paths.clubStatsSeason
1799
+ })
1800
+ });
1801
+ }
1802
+ return client_default.get(route(paths.clubStatsSeason, { team: parsed }));
1803
+ };
1804
+ var standings = (date) => {
1805
+ const parsed = NHLDate(date ?? getCurrentDate());
1806
+ if (isParseError(parsed)) {
1807
+ return Promise.resolve({
1808
+ status: "error",
1809
+ error: new ValidationError(parsed.summary, {
1810
+ endpoint: paths.standings
1811
+ })
1812
+ });
1813
+ }
1814
+ return client_default.get(route(paths.standings, { date: parsed }));
1815
+ };
1816
+ var standingsSeason = () => {
1817
+ return client_default.get(paths.standingsSeason);
1818
+ };
1819
+ var clubSchedule = (team, date, period) => {
1820
+ const parsed = ScheduleParams({ team, date, period });
1821
+ if (isParseError(parsed)) {
1822
+ return Promise.resolve({
1823
+ status: "error",
1824
+ error: new ValidationError(parsed.summary, {
1825
+ endpoint: paths.clubSchedule
1826
+ })
1827
+ });
1828
+ }
1829
+ if (period === "month") {
1830
+ parsed.date = parsed.date?.slice(0, 7);
1831
+ }
1832
+ return client_default.get(route(paths.clubSchedule, parsed));
1833
+ };
1834
+ var clubScheduleSeason = (team, season) => {
1835
+ const parsed = TeamAndSeasonParams({ team, season });
1836
+ if (isParseError(parsed)) {
1837
+ return Promise.resolve({
1838
+ status: "error",
1839
+ error: new ValidationError(parsed.summary, {
1840
+ endpoint: paths.clubScheduleSeason
1841
+ })
1842
+ });
1843
+ }
1844
+ return client_default.get(route(paths.clubScheduleSeason, parsed));
1845
+ };
1846
+ var schedule2 = {
1847
+ /** Returns the full season schedule for the provided team and season
1848
+ * @param team - The team abbreviation for the desired team
1849
+ * @param season - The specific season (e.g. 20222023); if not provided, defaults to the current season.
1850
+ * @returns A promise that resolves to the full season schedule for the specified team and season
1851
+ * @example
1852
+ * ```ts
1853
+ * // Get the full season schedule for the Boston Bruins for the 2022-2023 season
1854
+ * schedule.season('BOS', 20222023).then((data) => {
1855
+ * console.log(data);
1856
+ * });
1857
+ * ```
1858
+ */
1859
+ season: clubScheduleSeason,
1860
+ /**
1861
+ * Get the team schedule for any seven-day period
1862
+ * @param team - The team abbreviation
1863
+ * @param date - The date indicating the start of the seven-day period.
1864
+ * If not provided, defaults to the current date. format: 'YYYY-MM'
1865
+ * @returns A promise that resolves to the club schedule for the specified week
1866
+ *
1867
+ * @example
1868
+ * ```ts
1869
+ * import { schedule } from 'nhle-api';
1870
+ *
1871
+ * // Get the schedule for the Chicago Blackhawks for the week of November 4, 2023
1872
+ * // This returns the schedule from November 4 to November 10, 2023
1873
+ * schedule.week('CHI', '2023-11-04').then((data) => {
1874
+ * console.log(data);
1875
+ * });
1876
+ * ```
1877
+ */
1878
+ week: (team, date) => clubSchedule(team, date, "week"),
1879
+ /**
1880
+ * Get the team schedule for any month
1881
+ * @param team - The team abbreviation
1882
+ * @param date - The date indicating the month to get the schedule for.
1883
+ * If not provided, defaults to the current month. format: 'YYYY-MM'
1884
+ * @returns A promise that resolves to the club schedule for the specified month
1885
+ *
1886
+ * @example
1887
+ * ```ts
1888
+ * import { schedule } from 'nhle-api';
1889
+ *
1890
+ * // Get the schedule for the Toronto Maple Leafs for November 2023
1891
+ * schedule.month('TOR', '2023-11').then((data) => {
1892
+ * console.log(data);
1893
+ * });
1894
+ * ```
1895
+ */
1896
+ month: (team, date) => clubSchedule(team, date, "month")
1897
+ };
1898
+
1899
+ exports.EDGE = EDGE;
1900
+ exports.NHL = nhl_exports;
1901
+ exports.envConfig = envConfig;
1902
+ exports.gc = gamecenter_exports;
1903
+ exports.logEnvConfig = logEnvConfig;
1904
+ //# sourceMappingURL=index.cjs.map
1905
+ //# sourceMappingURL=index.cjs.map