nhle-api 0.5.3 → 0.6.0
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/CHANGELOG.md +78 -0
- package/README.md +319 -153
- package/lib/index.cjs +1600 -382
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3189 -614
- package/lib/index.d.ts +3189 -614
- package/lib/index.js +1576 -381
- package/lib/index.js.map +1 -1
- package/lib/nhl-B7Hg7iMB.d.cts +462 -0
- package/lib/nhl-B7Hg7iMB.d.ts +462 -0
- package/lib/toolkit.cjs +1216 -0
- package/lib/toolkit.cjs.map +1 -0
- package/lib/toolkit.d.cts +502 -0
- package/lib/toolkit.d.ts +502 -0
- package/lib/toolkit.js +1194 -0
- package/lib/toolkit.js.map +1 -0
- package/package.json +43 -10
package/lib/index.js
CHANGED
|
@@ -6,105 +6,72 @@ var __export = (target, all) => {
|
|
|
6
6
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// src/api/
|
|
10
|
-
var
|
|
11
|
-
__export(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
score: () => score,
|
|
17
|
-
scoreboard: () => scoreboard,
|
|
18
|
-
team: () => team_exports
|
|
9
|
+
// src/api/edge-adv/index.ts
|
|
10
|
+
var edge_adv_exports2 = {};
|
|
11
|
+
__export(edge_adv_exports2, {
|
|
12
|
+
byTheNumbers: () => byTheNumbers,
|
|
13
|
+
goalies: () => goalies_exports,
|
|
14
|
+
skaters: () => skaters_exports,
|
|
15
|
+
teams: () => teams_exports
|
|
19
16
|
});
|
|
20
17
|
|
|
21
|
-
// src/api/
|
|
22
|
-
var
|
|
23
|
-
__export(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
// src/api/edge-adv/goalies.ts
|
|
19
|
+
var goalies_exports = {};
|
|
20
|
+
__export(goalies_exports, {
|
|
21
|
+
compare: () => compare,
|
|
22
|
+
leaders: () => leaders,
|
|
23
|
+
player: () => player,
|
|
24
|
+
saveLocation: () => saveLocation,
|
|
25
|
+
savePercentage: () => savePercentage,
|
|
26
|
+
savePercentage5v5: () => savePercentage5v5,
|
|
27
|
+
top10: () => top10
|
|
27
28
|
});
|
|
28
29
|
|
|
29
|
-
// src/config/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
38
|
-
return 5e3;
|
|
39
|
-
}
|
|
40
|
-
return parsed;
|
|
41
|
-
}
|
|
42
|
-
function parseLanguage() {
|
|
43
|
-
const language = process.env.NHLE_API_LANGUAGE?.toLowerCase();
|
|
44
|
-
if (language === "fr") return "fr";
|
|
45
|
-
if (language && language !== "en") {
|
|
46
|
-
console.warn(
|
|
47
|
-
`Invalid NHLE_API_LANGUAGE: "${language}". Using default 'en'`
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
return "en";
|
|
51
|
-
}
|
|
52
|
-
function parseLogLevel() {
|
|
53
|
-
const logLevel = process.env.NHLE_API_LOGLEVEL?.toLowerCase();
|
|
54
|
-
const validLevels = [
|
|
55
|
-
"silent",
|
|
56
|
-
"error",
|
|
57
|
-
"warn",
|
|
58
|
-
"info",
|
|
59
|
-
"debug"
|
|
60
|
-
];
|
|
61
|
-
if (!logLevel) return "warn";
|
|
62
|
-
if (validLevels.includes(logLevel)) {
|
|
63
|
-
return logLevel;
|
|
64
|
-
}
|
|
65
|
-
console.warn(
|
|
66
|
-
`Invalid NHLE_API_LOGLEVEL: "${logLevel}". Valid options: ${validLevels.join(", ")}. Using default 'warn'`
|
|
67
|
-
);
|
|
68
|
-
return "warn";
|
|
30
|
+
// src/config/index.ts
|
|
31
|
+
var config = {
|
|
32
|
+
timeout: 5e3,
|
|
33
|
+
language: "en",
|
|
34
|
+
logLevel: "warn"
|
|
35
|
+
};
|
|
36
|
+
function logConfig() {
|
|
37
|
+
console.debug("NHL API Configuration:", config);
|
|
69
38
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* Language code for API responses
|
|
79
|
-
* Set via NHLE_API_LANGUAGE environment variable
|
|
80
|
-
* @default 'en'
|
|
81
|
-
*/
|
|
82
|
-
language: parseLanguage(),
|
|
83
|
-
/**
|
|
84
|
-
* Logging level for the client
|
|
85
|
-
* Set via NHLE_API_LOGLEVEL environment variable
|
|
86
|
-
* @default 'warn'
|
|
87
|
-
*/
|
|
88
|
-
logLevel: parseLogLevel()
|
|
39
|
+
|
|
40
|
+
// src/logging/index.ts
|
|
41
|
+
var levelRank = {
|
|
42
|
+
silent: 0,
|
|
43
|
+
error: 1,
|
|
44
|
+
warn: 2,
|
|
45
|
+
info: 3,
|
|
46
|
+
debug: 4
|
|
89
47
|
};
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
48
|
+
function isEnabled(level, threshold) {
|
|
49
|
+
return levelRank[level] > 0 && levelRank[level] <= levelRank[threshold];
|
|
50
|
+
}
|
|
51
|
+
function writeLog(level, message, context, threshold = config.logLevel) {
|
|
52
|
+
if (!isEnabled(level, threshold)) return;
|
|
53
|
+
const args = context === void 0 ? [message] : [message, context];
|
|
54
|
+
switch (level) {
|
|
55
|
+
case "error":
|
|
56
|
+
console.error(...args);
|
|
57
|
+
break;
|
|
58
|
+
case "warn":
|
|
59
|
+
console.warn(...args);
|
|
60
|
+
break;
|
|
61
|
+
case "info":
|
|
62
|
+
console.info(...args);
|
|
63
|
+
break;
|
|
64
|
+
case "debug":
|
|
65
|
+
console.debug(...args);
|
|
66
|
+
break;
|
|
106
67
|
}
|
|
107
68
|
}
|
|
69
|
+
var logger = {
|
|
70
|
+
error: (message, context) => writeLog("error", message, context),
|
|
71
|
+
warn: (message, context) => writeLog("warn", message, context),
|
|
72
|
+
info: (message, context) => writeLog("info", message, context),
|
|
73
|
+
debug: (message, context) => writeLog("debug", message, context)
|
|
74
|
+
};
|
|
108
75
|
|
|
109
76
|
// src/errors/index.ts
|
|
110
77
|
var ErrorCategory = {
|
|
@@ -124,6 +91,7 @@ var ErrorCategory = {
|
|
|
124
91
|
VALIDATION: "VALIDATION"
|
|
125
92
|
};
|
|
126
93
|
var LogLevel = {
|
|
94
|
+
NONE: 0,
|
|
127
95
|
ERROR: 1,
|
|
128
96
|
WARN: 2,
|
|
129
97
|
INFO: 3,
|
|
@@ -190,18 +158,30 @@ var APIError = class extends NHLError {
|
|
|
190
158
|
super(message, ErrorCategory.API_ERROR, context);
|
|
191
159
|
}
|
|
192
160
|
};
|
|
161
|
+
var ParseError = class extends NHLError {
|
|
162
|
+
constructor(message, context = {}) {
|
|
163
|
+
super(message, ErrorCategory.PARSE, context);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
193
166
|
var ValidationError = class extends NHLError {
|
|
194
167
|
constructor(message, context = {}) {
|
|
195
168
|
super(message, ErrorCategory.VALIDATION, context);
|
|
196
169
|
}
|
|
197
170
|
};
|
|
198
171
|
var ErrorHandler = class {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
172
|
+
overrides;
|
|
173
|
+
/**
|
|
174
|
+
* @param config - Overrides; an unset `logLevel` follows the shared
|
|
175
|
+
* `config.logLevel` at log time.
|
|
176
|
+
*/
|
|
177
|
+
constructor(config2 = {}) {
|
|
178
|
+
this.overrides = { ...config2 };
|
|
179
|
+
}
|
|
180
|
+
get config() {
|
|
181
|
+
return {
|
|
182
|
+
logLevel: this.overrides.logLevel ?? toErrorLogLevel(config.logLevel),
|
|
183
|
+
logger: this.overrides.logger ?? this.defaultLogger.bind(this),
|
|
184
|
+
includeStack: this.overrides.includeStack ?? true
|
|
205
185
|
};
|
|
206
186
|
}
|
|
207
187
|
/**
|
|
@@ -209,8 +189,12 @@ var ErrorHandler = class {
|
|
|
209
189
|
*/
|
|
210
190
|
defaultLogger(level, message, context) {
|
|
211
191
|
if (level > this.config.logLevel) return;
|
|
212
|
-
|
|
213
|
-
|
|
192
|
+
writeLog(
|
|
193
|
+
toClientLogLevel(level),
|
|
194
|
+
`[NHL API] ${message}`,
|
|
195
|
+
context,
|
|
196
|
+
toClientThreshold(this.config.logLevel)
|
|
197
|
+
);
|
|
214
198
|
}
|
|
215
199
|
/**
|
|
216
200
|
* Log an error based on configuration
|
|
@@ -308,44 +292,84 @@ var ErrorHandler = class {
|
|
|
308
292
|
/**
|
|
309
293
|
* Update configuration
|
|
310
294
|
*/
|
|
311
|
-
configure(
|
|
312
|
-
this.
|
|
295
|
+
configure(config2) {
|
|
296
|
+
this.overrides = { ...this.overrides, ...config2 };
|
|
313
297
|
}
|
|
314
298
|
};
|
|
299
|
+
function toErrorLogLevel(level) {
|
|
300
|
+
switch (level) {
|
|
301
|
+
case "silent":
|
|
302
|
+
return LogLevel.NONE;
|
|
303
|
+
case "error":
|
|
304
|
+
return LogLevel.ERROR;
|
|
305
|
+
case "warn":
|
|
306
|
+
return LogLevel.WARN;
|
|
307
|
+
case "info":
|
|
308
|
+
return LogLevel.INFO;
|
|
309
|
+
case "debug":
|
|
310
|
+
return LogLevel.DEBUG;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function toClientLogLevel(level) {
|
|
314
|
+
switch (level) {
|
|
315
|
+
case LogLevel.ERROR:
|
|
316
|
+
return "error";
|
|
317
|
+
case LogLevel.WARN:
|
|
318
|
+
return "warn";
|
|
319
|
+
case LogLevel.INFO:
|
|
320
|
+
return "info";
|
|
321
|
+
case LogLevel.DEBUG:
|
|
322
|
+
return "debug";
|
|
323
|
+
default:
|
|
324
|
+
return "debug";
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function toClientThreshold(level) {
|
|
328
|
+
return level === LogLevel.NONE ? "silent" : toClientLogLevel(level);
|
|
329
|
+
}
|
|
315
330
|
new ErrorHandler();
|
|
316
331
|
|
|
317
|
-
// src/client/types.ts
|
|
318
|
-
var API_BASE_URLS = {
|
|
319
|
-
"edge-adv": "https://api-web.nhle.com/v1",
|
|
320
|
-
"edge-stats": "https://api.nhle.com/stats/rest",
|
|
321
|
-
default: "https://api-web.nhle.com/v1"
|
|
322
|
-
};
|
|
323
|
-
|
|
324
332
|
// src/client/index.ts
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
language: envConfig.language
|
|
333
|
+
var BASE_URLS = {
|
|
334
|
+
gamecenter: "https://api-web.nhle.com/v1",
|
|
335
|
+
edgeStats: "https://api.nhle.com/stats/rest"
|
|
336
|
+
};
|
|
337
|
+
var DEFAULT_HEADERS = {
|
|
338
|
+
Accept: "application/json"
|
|
332
339
|
};
|
|
333
340
|
var NHLClient = class {
|
|
334
|
-
|
|
341
|
+
options;
|
|
335
342
|
errorHandler;
|
|
336
343
|
/**
|
|
337
344
|
* Creates a new NHL API client instance
|
|
338
|
-
*
|
|
345
|
+
*
|
|
346
|
+
* Options left unset (timeout, language) follow the shared `config`
|
|
347
|
+
* object at request time, so changing `config` after import still
|
|
348
|
+
* applies to this client.
|
|
349
|
+
*
|
|
350
|
+
* @param baseURLOrOptions - Base URL, or client options
|
|
339
351
|
* @param errorConfig - Optional error handling configuration
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* const client = new NHLClient('https://api-web.nhle.com/v1');
|
|
355
|
+
* const slow = new NHLClient({ timeout: 15000, language: 'fr' });
|
|
340
356
|
*/
|
|
341
|
-
constructor(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
357
|
+
constructor(baseURLOrOptions, errorConfig) {
|
|
358
|
+
const options = typeof baseURLOrOptions === "string" ? { baseUrl: baseURLOrOptions } : baseURLOrOptions ?? {};
|
|
359
|
+
const { errorConfig: optionsErrorConfig, ...clientOptions } = options;
|
|
360
|
+
this.options = clientOptions;
|
|
361
|
+
this.errorHandler = new ErrorHandler(
|
|
362
|
+
errorConfig ?? optionsErrorConfig
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
/** Base URL, timeout, headers and language in effect for the next request. */
|
|
366
|
+
get config() {
|
|
367
|
+
return {
|
|
368
|
+
baseUrl: this.options.baseUrl ?? BASE_URLS.gamecenter,
|
|
369
|
+
timeout: this.options.timeout ?? config.timeout,
|
|
370
|
+
headers: { ...DEFAULT_HEADERS, ...this.options.headers },
|
|
371
|
+
language: this.options.language ?? config.language
|
|
372
|
+
};
|
|
349
373
|
}
|
|
350
374
|
/**
|
|
351
375
|
* Helper to build URL with query parameters
|
|
@@ -370,18 +394,16 @@ var NHLClient = class {
|
|
|
370
394
|
* @returns Promise resolving to an APIResponse containing either data or error
|
|
371
395
|
*/
|
|
372
396
|
async get(endpoint, params) {
|
|
397
|
+
const { timeout, headers, language } = this.config;
|
|
373
398
|
const url = this.buildUrl(endpoint, params);
|
|
374
399
|
const controller = new AbortController();
|
|
375
|
-
const timeoutId = setTimeout(
|
|
376
|
-
() => controller.abort(),
|
|
377
|
-
this.config.timeout
|
|
378
|
-
);
|
|
400
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
379
401
|
try {
|
|
380
402
|
const response = await fetch(url, {
|
|
381
403
|
method: "GET",
|
|
382
404
|
headers: {
|
|
383
|
-
...
|
|
384
|
-
"Accept-Language":
|
|
405
|
+
...headers,
|
|
406
|
+
"Accept-Language": language
|
|
385
407
|
},
|
|
386
408
|
signal: controller.signal
|
|
387
409
|
});
|
|
@@ -391,14 +413,14 @@ var NHLClient = class {
|
|
|
391
413
|
endpoint: url
|
|
392
414
|
});
|
|
393
415
|
this.errorHandler.log(error);
|
|
394
|
-
return {
|
|
416
|
+
return { success: false, error };
|
|
395
417
|
}
|
|
396
|
-
return { data: await response.json(),
|
|
418
|
+
return { data: await response.json(), success: true };
|
|
397
419
|
} catch (error) {
|
|
398
420
|
clearTimeout(timeoutId);
|
|
399
421
|
if (error instanceof NHLError) {
|
|
400
422
|
this.errorHandler.log(error);
|
|
401
|
-
return {
|
|
423
|
+
return { success: false, error };
|
|
402
424
|
}
|
|
403
425
|
let nhlError;
|
|
404
426
|
if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -416,59 +438,22 @@ var NHLClient = class {
|
|
|
416
438
|
});
|
|
417
439
|
}
|
|
418
440
|
this.errorHandler.log(nhlError);
|
|
419
|
-
return {
|
|
441
|
+
return { success: false, error: nhlError };
|
|
420
442
|
}
|
|
421
443
|
}
|
|
422
444
|
/**
|
|
423
445
|
* Configure error handling behavior
|
|
424
446
|
* @param config - Error configuration options
|
|
425
447
|
*/
|
|
426
|
-
configureErrorHandling(
|
|
427
|
-
this.errorHandler.configure(
|
|
448
|
+
configureErrorHandling(config2) {
|
|
449
|
+
this.errorHandler.configure(config2);
|
|
428
450
|
}
|
|
429
451
|
};
|
|
430
|
-
function createNHLClient(
|
|
431
|
-
return new NHLClient(
|
|
452
|
+
function createNHLClient(baseURLOrOptions, errorConfig) {
|
|
453
|
+
return new NHLClient(baseURLOrOptions, errorConfig);
|
|
432
454
|
}
|
|
433
|
-
var nhlClient = createNHLClient(
|
|
434
|
-
createNHLClient(
|
|
435
|
-
var client_default = nhlClient;
|
|
436
|
-
|
|
437
|
-
// src/utils/date.ts
|
|
438
|
-
var NHL_TIMEZONE = "America/New_York";
|
|
439
|
-
var getDate = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
440
|
-
timeZone: NHL_TIMEZONE,
|
|
441
|
-
year: "numeric",
|
|
442
|
-
month: "2-digit",
|
|
443
|
-
day: "2-digit"
|
|
444
|
-
}).format(date);
|
|
445
|
-
var getCurrentDate = () => getDate(/* @__PURE__ */ new Date());
|
|
446
|
-
var getYear = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
447
|
-
timeZone: NHL_TIMEZONE,
|
|
448
|
-
year: "numeric"
|
|
449
|
-
}).format(date);
|
|
450
|
-
var getCurrentYear = () => getYear(/* @__PURE__ */ new Date());
|
|
451
|
-
var getSeason = (date) => {
|
|
452
|
-
const format = new Intl.DateTimeFormat("en-CA", {
|
|
453
|
-
timeZone: NHL_TIMEZONE,
|
|
454
|
-
year: "numeric",
|
|
455
|
-
month: "numeric"
|
|
456
|
-
}).formatToParts(date instanceof Date ? date : new Date(date));
|
|
457
|
-
const month = format.find((part) => part.type === "month")?.value;
|
|
458
|
-
const year = format.find((part) => part.type === "year")?.value;
|
|
459
|
-
if (!year) {
|
|
460
|
-
throw new Error("Invalid date provided, could not extract year");
|
|
461
|
-
}
|
|
462
|
-
if (month && parseInt(month, 10) < 7) {
|
|
463
|
-
console.log(month, parseInt(month, 10) < 7);
|
|
464
|
-
return `${parseInt(year, 10) - 1}${year}`;
|
|
465
|
-
}
|
|
466
|
-
return `${year}${parseInt(year, 10) + 1}`;
|
|
467
|
-
};
|
|
468
|
-
var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
|
|
469
|
-
/* @__PURE__ */ new Date(
|
|
470
|
-
`${getCurrentSeason().slice(4, 8)}-06-30`
|
|
471
|
-
);
|
|
455
|
+
var nhlClient = createNHLClient(BASE_URLS.gamecenter);
|
|
456
|
+
var edgeStatsClient = createNHLClient(BASE_URLS.edgeStats);
|
|
472
457
|
|
|
473
458
|
// src/constants/edge-adv.ts
|
|
474
459
|
var edge_adv_exports = {};
|
|
@@ -590,9 +575,6 @@ var ZoneTimeSortEnum = {
|
|
|
590
575
|
NZ: "neutral"
|
|
591
576
|
};
|
|
592
577
|
|
|
593
|
-
// src/constants/edge-stats.ts
|
|
594
|
-
var edge_stats_exports = {};
|
|
595
|
-
|
|
596
578
|
// src/constants/nhl.ts
|
|
597
579
|
var nhl_exports = {};
|
|
598
580
|
__export(nhl_exports, {
|
|
@@ -617,6 +599,50 @@ __export(nhl_exports, {
|
|
|
617
599
|
TeamsReverseEnum: () => TeamsReverseEnum,
|
|
618
600
|
YEAR_RANGE: () => YEAR_RANGE
|
|
619
601
|
});
|
|
602
|
+
|
|
603
|
+
// src/utils/date.ts
|
|
604
|
+
var NHL_TIMEZONE = "America/New_York";
|
|
605
|
+
var getNHLDate = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
606
|
+
timeZone: NHL_TIMEZONE,
|
|
607
|
+
year: "numeric",
|
|
608
|
+
month: "2-digit",
|
|
609
|
+
day: "2-digit"
|
|
610
|
+
}).format(date);
|
|
611
|
+
var getCurrentNHLDate = () => getNHLDate(/* @__PURE__ */ new Date());
|
|
612
|
+
var getNHLMonth = (date) => {
|
|
613
|
+
return new Intl.DateTimeFormat("en-CA", {
|
|
614
|
+
timeZone: NHL_TIMEZONE,
|
|
615
|
+
year: "numeric",
|
|
616
|
+
month: "2-digit"
|
|
617
|
+
}).format(date);
|
|
618
|
+
};
|
|
619
|
+
var getYear = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
620
|
+
timeZone: NHL_TIMEZONE,
|
|
621
|
+
year: "numeric"
|
|
622
|
+
}).format(date);
|
|
623
|
+
var getCurrentNHLYear = () => getYear(/* @__PURE__ */ new Date());
|
|
624
|
+
var getSeason = (date) => {
|
|
625
|
+
const format = new Intl.DateTimeFormat("en-CA", {
|
|
626
|
+
timeZone: NHL_TIMEZONE,
|
|
627
|
+
year: "numeric",
|
|
628
|
+
month: "numeric"
|
|
629
|
+
}).formatToParts(date instanceof Date ? date : new Date(date));
|
|
630
|
+
const month = format.find((part) => part.type === "month")?.value;
|
|
631
|
+
const year = format.find((part) => part.type === "year")?.value;
|
|
632
|
+
if (!year) {
|
|
633
|
+
throw new Error("Invalid date provided, could not extract year");
|
|
634
|
+
}
|
|
635
|
+
if (month && parseInt(month, 10) < 7) {
|
|
636
|
+
return `${parseInt(year, 10) - 1}${year}`;
|
|
637
|
+
}
|
|
638
|
+
return `${year}${parseInt(year, 10) + 1}`;
|
|
639
|
+
};
|
|
640
|
+
var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
|
|
641
|
+
/* @__PURE__ */ new Date(
|
|
642
|
+
`${getCurrentSeason().slice(4, 8)}-06-30`
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
// src/constants/nhl.ts
|
|
620
646
|
var TeamsEnum = {
|
|
621
647
|
/** Anaheim Ducks */
|
|
622
648
|
ANA: 24,
|
|
@@ -951,19 +977,26 @@ var YEAR_RANGE = {
|
|
|
951
977
|
var START_YEAR = YEAR_RANGE.START;
|
|
952
978
|
var END_YEAR = YEAR_RANGE.END;
|
|
953
979
|
var CURRENT = {
|
|
954
|
-
|
|
980
|
+
/** The season for today's date, so the default never goes stale. */
|
|
981
|
+
SEASON: Number(getCurrentSeason()),
|
|
955
982
|
YEAR: YEAR_RANGE.END
|
|
956
983
|
};
|
|
957
984
|
var PLAYER_ID_RANGE = { MIN: 8444e3, MAX: 8489999 };
|
|
958
985
|
var TEAM_ID_RANGE = { MIN: 1, MAX: 59 };
|
|
959
986
|
|
|
960
987
|
// src/constants/index.ts
|
|
961
|
-
var EDGE = { ...edge_adv_exports
|
|
988
|
+
var EDGE = { ...edge_adv_exports };
|
|
962
989
|
|
|
963
990
|
// src/utils/schemas.ts
|
|
964
991
|
function isParseError(value) {
|
|
965
992
|
return value instanceof type.errors;
|
|
966
993
|
}
|
|
994
|
+
function invalidParams(errors, endpoint) {
|
|
995
|
+
return {
|
|
996
|
+
success: false,
|
|
997
|
+
error: new ValidationError(errors.summary, { endpoint })
|
|
998
|
+
};
|
|
999
|
+
}
|
|
967
1000
|
var Year = type(`${nhl_exports.START_YEAR} <= number <= ${nhl_exports.END_YEAR}`).or(
|
|
968
1001
|
type("string.numeric.parse").narrow((v) => {
|
|
969
1002
|
return v >= nhl_exports.START_YEAR && v <= nhl_exports.END_YEAR;
|
|
@@ -976,11 +1009,11 @@ var NHLMonth = type("Date | string").narrow((v) => {
|
|
|
976
1009
|
return true;
|
|
977
1010
|
}
|
|
978
1011
|
return false;
|
|
979
|
-
}).pipe((v) => typeof v === "string" ? v : v
|
|
1012
|
+
}).pipe((v) => typeof v === "string" ? v : getNHLMonth(v)).describe(
|
|
980
1013
|
"a valid month, either as a string (formatted as YYYY-MM) or a Date object"
|
|
981
1014
|
);
|
|
982
1015
|
var NHLDate = type("Date | string.date.iso").pipe(
|
|
983
|
-
(v) => typeof v === "string" ? new Date(v).toISOString().slice(0, 10) : v
|
|
1016
|
+
(v) => typeof v === "string" ? new Date(v).toISOString().slice(0, 10) : getNHLDate(v)
|
|
984
1017
|
).describe(
|
|
985
1018
|
"a valid date, either as a string (ISO date string) or a Date object"
|
|
986
1019
|
);
|
|
@@ -1030,35 +1063,37 @@ var GameId = type("number.integer | string.numeric.parse").narrow((v) => {
|
|
|
1030
1063
|
var SeriesLetter = type.enumerated(...Object.values(nhl_exports.SeriesLetterEnum)).describe("a valid NHL playoff series letter (A-O)");
|
|
1031
1064
|
type.enumerated(...Object.values(nhl_exports.GameStateEnum)).describe("a valid NHL game state");
|
|
1032
1065
|
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");
|
|
1033
|
-
var PostalCode = type(/^[a-zA-Z]\d[a-zA-Z][ -]?\d[a-zA-Z]\d$/).or(type(/^\d{5}$/)).
|
|
1034
|
-
|
|
1066
|
+
var PostalCode = type(/^[a-zA-Z]\d[a-zA-Z][ -]?\d[a-zA-Z]\d$/).or(type(/^\d{5}$/)).pipe(
|
|
1067
|
+
(v) => v.length === 5 ? v : `${v.slice(0, 3)} ${v.slice(-3)}`.toUpperCase()
|
|
1068
|
+
).describe(
|
|
1069
|
+
"a valid postal code, either US ZIP code (5 digit) or Canadian postal code (A1A 1A1, A1A1A1 or A1A-1A1)"
|
|
1035
1070
|
);
|
|
1036
1071
|
var PlayerId = type("number").atLeast(nhl_exports.PLAYER_ID_RANGE.MIN).atMost(nhl_exports.PLAYER_ID_RANGE.MAX).or(
|
|
1037
1072
|
type("string.numeric.parse").narrow((v) => {
|
|
1038
1073
|
return v >= nhl_exports.PLAYER_ID_RANGE.MIN && v <= nhl_exports.PLAYER_ID_RANGE.MAX;
|
|
1039
1074
|
})
|
|
1040
1075
|
).pipe((v) => v.toString()).describe("a valid NHL player ID");
|
|
1041
|
-
type.enumerated(
|
|
1076
|
+
var SaveLocationCategory = type.enumerated(
|
|
1042
1077
|
...Object.keys(
|
|
1043
1078
|
EDGE.SaveLocationCategoryEnum
|
|
1044
1079
|
)
|
|
1045
1080
|
).pipe((v) => EDGE.SaveLocationCategoryEnum[v]);
|
|
1046
|
-
type.enumerated(
|
|
1081
|
+
var ShotLocationSort = type.enumerated(
|
|
1047
1082
|
...Object.keys(
|
|
1048
1083
|
EDGE.ShotLocationSortEnum
|
|
1049
1084
|
)
|
|
1050
1085
|
).pipe((v) => EDGE.ShotLocationSortEnum[v]);
|
|
1051
|
-
type.enumerated(
|
|
1086
|
+
var SaveLocationSort = type.enumerated(
|
|
1052
1087
|
...Object.keys(
|
|
1053
1088
|
EDGE.SaveLocationSortEnum
|
|
1054
1089
|
)
|
|
1055
1090
|
).pipe((v) => EDGE.SaveLocationSortEnum[v]);
|
|
1056
|
-
type.enumerated(
|
|
1091
|
+
var SavePercentage5v5Sort = type.enumerated(
|
|
1057
1092
|
...Object.keys(
|
|
1058
1093
|
EDGE.SavePercentage5v5SortEnum
|
|
1059
1094
|
)
|
|
1060
1095
|
).pipe((v) => EDGE.SavePercentage5v5SortEnum[v]);
|
|
1061
|
-
type.enumerated(
|
|
1096
|
+
var SavePercentageSort = type.enumerated(
|
|
1062
1097
|
...Object.keys(
|
|
1063
1098
|
EDGE.SavePercentageSortEnum
|
|
1064
1099
|
)
|
|
@@ -1073,47 +1108,52 @@ var SkatersStrength = type.enumerated(
|
|
|
1073
1108
|
EDGE.SkatersStrengthEnum
|
|
1074
1109
|
)
|
|
1075
1110
|
).pipe((v) => EDGE.SkatersStrengthEnum[v]);
|
|
1076
|
-
type.enumerated(
|
|
1111
|
+
var ShotSpeedSort = type.enumerated(
|
|
1077
1112
|
...Object.keys(
|
|
1078
1113
|
EDGE.ShotSpeedSortEnum
|
|
1079
1114
|
)
|
|
1080
1115
|
).pipe((v) => EDGE.ShotSpeedSortEnum[v]);
|
|
1081
|
-
type.enumerated(
|
|
1116
|
+
var SkatingSpeedSort = type.enumerated(
|
|
1082
1117
|
...Object.keys(
|
|
1083
1118
|
EDGE.SkatingSpeedSortEnum
|
|
1084
1119
|
)
|
|
1085
1120
|
).pipe((v) => EDGE.SkatingSpeedSortEnum[v]);
|
|
1086
|
-
type.enumerated(
|
|
1121
|
+
var SkatingDistanceSort = type.enumerated(
|
|
1087
1122
|
...Object.keys(
|
|
1088
1123
|
EDGE.SkatingDistanceSortEnum
|
|
1089
1124
|
)
|
|
1090
|
-
);
|
|
1091
|
-
type.enumerated(
|
|
1125
|
+
).pipe((v) => EDGE.SkatingDistanceSortEnum[v]);
|
|
1126
|
+
var ShotLocationCategory = type.enumerated(
|
|
1092
1127
|
...Object.keys(
|
|
1093
1128
|
EDGE.ShotLocationCategoryEnum
|
|
1094
1129
|
)
|
|
1095
1130
|
).pipe((v) => EDGE.ShotLocationCategoryEnum[v]);
|
|
1096
|
-
type.enumerated(
|
|
1131
|
+
var ZoneTimeSort = type.enumerated(
|
|
1097
1132
|
...Object.keys(
|
|
1098
1133
|
EDGE.ZoneTimeSortEnum
|
|
1099
1134
|
)
|
|
1100
1135
|
).pipe((v) => EDGE.ZoneTimeSortEnum[v]);
|
|
1136
|
+
function withDefault(schema, fallback) {
|
|
1137
|
+
const resolved = schema.assert(fallback);
|
|
1138
|
+
const optional = schema.or("undefined").pipe((v) => v ?? resolved);
|
|
1139
|
+
return [optional, "=", fallback];
|
|
1140
|
+
}
|
|
1101
1141
|
var BaseParams = type({
|
|
1102
1142
|
season: Season.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.SEASON),
|
|
1103
1143
|
gameType: GameType.or("undefined").pipe(
|
|
1104
1144
|
(v) => v ?? nhl_exports.GameTypeEnum.REG
|
|
1105
1145
|
)
|
|
1106
1146
|
});
|
|
1107
|
-
BaseParams.merge({
|
|
1147
|
+
var PlayerParams = BaseParams.merge({
|
|
1108
1148
|
playerId: PlayerId,
|
|
1109
1149
|
season: Season
|
|
1110
1150
|
});
|
|
1111
|
-
BaseParams.merge({
|
|
1151
|
+
var TeamParams = BaseParams.merge({
|
|
1112
1152
|
teamId: TeamId
|
|
1113
1153
|
});
|
|
1114
|
-
BaseParams.merge({
|
|
1115
|
-
position: PositionFilter
|
|
1116
|
-
strength: SkatersStrength
|
|
1154
|
+
var top10Params = BaseParams.merge({
|
|
1155
|
+
position: withDefault(PositionFilter, "ALL"),
|
|
1156
|
+
strength: withDefault(SkatersStrength, "ALL")
|
|
1117
1157
|
});
|
|
1118
1158
|
var DraftParams = type({
|
|
1119
1159
|
year: Year.or("undefined").pipe((v) => v ?? nhl_exports.CURRENT.YEAR),
|
|
@@ -1137,92 +1177,1189 @@ var SeriesParams = type({
|
|
|
1137
1177
|
});
|
|
1138
1178
|
var ScheduleParams = type({
|
|
1139
1179
|
team: TeamAbbrev,
|
|
1140
|
-
date: NHLDate.or("undefined").pipe((v) => v ??
|
|
1180
|
+
date: NHLDate.or("undefined").pipe((v) => v ?? getCurrentNHLDate()),
|
|
1141
1181
|
month: NHLMonth.or("undefined").pipe(
|
|
1142
|
-
(v) => v ??
|
|
1182
|
+
(v) => v ?? getCurrentNHLDate().slice(0, 7)
|
|
1143
1183
|
)
|
|
1144
1184
|
});
|
|
1145
1185
|
|
|
1146
1186
|
// src/utils/utils.ts
|
|
1147
|
-
function
|
|
1148
|
-
let
|
|
1187
|
+
function resolvePath(template, params) {
|
|
1188
|
+
let resolvedPath = template;
|
|
1149
1189
|
for (const [key, value] of Object.entries(params)) {
|
|
1150
1190
|
if (value === void 0) continue;
|
|
1151
|
-
|
|
1191
|
+
resolvedPath = resolvedPath.replace(`{${key}}`, String(value));
|
|
1152
1192
|
}
|
|
1153
|
-
return
|
|
1193
|
+
return resolvedPath;
|
|
1154
1194
|
}
|
|
1155
1195
|
|
|
1156
|
-
// src/api/
|
|
1157
|
-
var
|
|
1196
|
+
// src/api/edge-adv/paths.ts
|
|
1197
|
+
var goaliesPaths = {
|
|
1198
|
+
/** Goalie detail page. */
|
|
1199
|
+
player: "edge/goalie-detail/{playerId}/{season}/{gameType}",
|
|
1200
|
+
/** Goalie comparison data. */
|
|
1201
|
+
compare: "edge/goalie-comparison/{playerId}/{season}/{gameType}",
|
|
1202
|
+
/** Goalie leaders landing page. */
|
|
1203
|
+
leaders: "edge/goalie-landing/{season}/{gameType}",
|
|
1204
|
+
/** Goalie 5v5 save percentage statistics. */
|
|
1205
|
+
savePercentage5v5: "edge/goalie-5v5-detail/{playerId}/{season}/{gameType}",
|
|
1206
|
+
/** Goalie save percentage statistics. */
|
|
1207
|
+
savePercentage: "edge/goalie-save-percentage-detail/{playerId}/{season}/{gameType}",
|
|
1208
|
+
/** Goalie shot location analysis. */
|
|
1209
|
+
saveLocation: "edge/goalie-shot-location-detail/{playerId}/{season}/{gameType}",
|
|
1210
|
+
/** Goalie top 10 leaders. */
|
|
1211
|
+
top10: {
|
|
1212
|
+
/** Top 10 goalies by save percentage. */
|
|
1213
|
+
savePercentage: "edge/goalie-edge-save-pctg-top-10/{sortBy}/{season}/{gameType}",
|
|
1214
|
+
/** Top 10 goalies by 5v5 save percentage. */
|
|
1215
|
+
savePercentage5v5: "edge/goalie-5v5-top-10/{sortBy}/{season}/{gameType}",
|
|
1216
|
+
/** Top 10 goalies by shot location. */
|
|
1217
|
+
saveLocation: "edge/goalie-shot-location-top-10/{category}/{sortBy}/{season}/{gameType}"
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
var skatersPaths = {
|
|
1221
|
+
/** Skater detail page. */
|
|
1222
|
+
player: "edge/skater-detail/{playerId}/{season}/{gameType}",
|
|
1223
|
+
/** Skater comparison data. */
|
|
1224
|
+
compare: "edge/skater-comparison/{playerId}/{season}/{gameType}",
|
|
1225
|
+
/** Skater leaders landing page. */
|
|
1226
|
+
leaders: "edge/skater-landing/{season}/{gameType}",
|
|
1227
|
+
/** Skater shot location analysis. */
|
|
1228
|
+
shotLocation: "edge/skater-shot-location-detail/{playerId}/{season}/{gameType}",
|
|
1229
|
+
/** Skater shot speed analysis. */
|
|
1230
|
+
shotSpeed: "edge/skater-shot-speed-detail/{playerId}/{season}/{gameType}",
|
|
1231
|
+
/** Skater skating distance analysis. */
|
|
1232
|
+
skatingDistance: "edge/skater-skating-distance-detail/{playerId}/{season}/{gameType}",
|
|
1233
|
+
/** Skater skating speed analysis. */
|
|
1234
|
+
skatingSpeed: "edge/skater-skating-speed-detail/{playerId}/{season}/{gameType}",
|
|
1235
|
+
/** Skater zone time analysis. */
|
|
1236
|
+
zoneTime: "edge/skater-zone-time/{playerId}/{season}/{gameType}",
|
|
1237
|
+
/** Skater top 10 leaders. */
|
|
1238
|
+
top10: {
|
|
1239
|
+
/** Top 10 skaters by shot location. */
|
|
1240
|
+
shotLocation: "edge/skater-shot-location-top-10/{position}/{category}/{sortBy}/{season}/{gameType}",
|
|
1241
|
+
/** Top 10 skaters by shot speed. */
|
|
1242
|
+
shotSpeed: "edge/skater-shot-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1243
|
+
/** Top 10 skaters by skating distance. */
|
|
1244
|
+
skatingDistance: "edge/skater-distance-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}",
|
|
1245
|
+
/** Top 10 skaters by skating speed. */
|
|
1246
|
+
skatingSpeed: "edge/skater-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1247
|
+
/** Top 10 skaters by zone time. */
|
|
1248
|
+
zoneTime: "edge/skater-zone-time-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}"
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
var teamsPaths = {
|
|
1252
|
+
/** Team statistics detail page. */
|
|
1253
|
+
stats: "edge/team-detail/{teamId}/{season}/{gameType}",
|
|
1254
|
+
/** Team comparison data. */
|
|
1255
|
+
compare: "edge/team-comparison/{teamId}/{season}/{gameType}",
|
|
1256
|
+
/** Team leaders landing page. */
|
|
1257
|
+
leaders: "edge/team-landing/{season}/{gameType}",
|
|
1258
|
+
/** Team shot location analysis. */
|
|
1259
|
+
shotLocation: "edge/team-shot-location-detail/{teamId}/{season}/{gameType}",
|
|
1260
|
+
/** Team shot speed analysis. */
|
|
1261
|
+
shotSpeed: "edge/team-shot-speed-detail/{teamId}/{season}/{gameType}",
|
|
1262
|
+
/** Team skating distance analysis. */
|
|
1263
|
+
skatingDistance: "edge/team-skating-distance-detail/{teamId}/{season}/{gameType}",
|
|
1264
|
+
/** Team skating speed analysis. */
|
|
1265
|
+
skatingSpeed: "edge/team-skating-speed-detail/{teamId}/{season}/{gameType}",
|
|
1266
|
+
/** Team zone time analysis. */
|
|
1267
|
+
zoneTime: "edge/team-zone-time-details/{teamId}/{season}/{gameType}",
|
|
1268
|
+
/** Team top 10 leaders. */
|
|
1269
|
+
top10: {
|
|
1270
|
+
/** Top 10 teams by shot location. */
|
|
1271
|
+
shotLocation: "edge/team-shot-location-top-10/{position}/{category}/{sortBy}/{season}/{gameType}",
|
|
1272
|
+
/** Top 10 teams by shot speed. */
|
|
1273
|
+
shotSpeed: "edge/team-shot-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1274
|
+
/** Top 10 teams by skating distance. */
|
|
1275
|
+
skatingDistance: "edge/team-skating-distance-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}",
|
|
1276
|
+
/** Top 10 teams by skating speed. */
|
|
1277
|
+
skatingSpeed: "edge/team-skating-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1278
|
+
/** Top 10 teams by zone time. */
|
|
1279
|
+
zoneTime: "edge/team-zone-time-top-10/{strength}/{sortBy}/{season}/{gameType}"
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
var summaryPaths = {
|
|
1283
|
+
/** By the numbers summary. */
|
|
1284
|
+
byTheNumbers: "edge/by-the-numbers/now"
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
// src/api/edge-adv/goalies.ts
|
|
1288
|
+
async function player(playerId, season, gameType) {
|
|
1289
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1290
|
+
if (isParseError(parsed)) return invalidParams(parsed, goaliesPaths.player);
|
|
1291
|
+
const path = resolvePath(goaliesPaths.player, parsed);
|
|
1292
|
+
return nhlClient.get(path);
|
|
1293
|
+
}
|
|
1294
|
+
async function compare(playerId, season, gameType) {
|
|
1295
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1296
|
+
if (isParseError(parsed)) return invalidParams(parsed, goaliesPaths.compare);
|
|
1297
|
+
const path = resolvePath(goaliesPaths.compare, parsed);
|
|
1298
|
+
return nhlClient.get(path);
|
|
1299
|
+
}
|
|
1300
|
+
async function leaders(season, gameType) {
|
|
1301
|
+
const parsed = BaseParams({ season, gameType });
|
|
1302
|
+
if (isParseError(parsed)) return invalidParams(parsed, goaliesPaths.leaders);
|
|
1303
|
+
const path = resolvePath(goaliesPaths.leaders, parsed);
|
|
1304
|
+
return nhlClient.get(path);
|
|
1305
|
+
}
|
|
1306
|
+
async function savePercentage5v5(playerId, season, gameType) {
|
|
1307
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1308
|
+
if (isParseError(parsed))
|
|
1309
|
+
return invalidParams(parsed, goaliesPaths.savePercentage5v5);
|
|
1310
|
+
const path = resolvePath(goaliesPaths.savePercentage5v5, parsed);
|
|
1311
|
+
return nhlClient.get(path);
|
|
1312
|
+
}
|
|
1313
|
+
async function savePercentage(playerId, season, gameType) {
|
|
1314
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1315
|
+
if (isParseError(parsed)) return invalidParams(parsed, goaliesPaths.savePercentage);
|
|
1316
|
+
const path = resolvePath(goaliesPaths.savePercentage, parsed);
|
|
1317
|
+
return nhlClient.get(path);
|
|
1318
|
+
}
|
|
1319
|
+
async function saveLocation(playerId, season, gameType) {
|
|
1320
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1321
|
+
if (isParseError(parsed)) return invalidParams(parsed, goaliesPaths.saveLocation);
|
|
1322
|
+
const path = resolvePath(goaliesPaths.saveLocation, parsed);
|
|
1323
|
+
return nhlClient.get(path);
|
|
1324
|
+
}
|
|
1325
|
+
var top10 = {
|
|
1326
|
+
savePercentage: top10SavePercentage,
|
|
1327
|
+
savePercentage5v5: top10SavePercentage5v5,
|
|
1328
|
+
saveLocation: top10SaveLocation
|
|
1329
|
+
};
|
|
1330
|
+
async function top10SavePercentage(season, gameType, sortBy) {
|
|
1331
|
+
const Parser = BaseParams.merge({
|
|
1332
|
+
sortBy: withDefault(SavePercentageSort, "GAMES")
|
|
1333
|
+
});
|
|
1334
|
+
const parsed = Parser({ season, gameType, sortBy });
|
|
1335
|
+
if (isParseError(parsed))
|
|
1336
|
+
return invalidParams(parsed, goaliesPaths.top10.savePercentage);
|
|
1337
|
+
const path = resolvePath(goaliesPaths.top10.savePercentage, parsed);
|
|
1338
|
+
return nhlClient.get(path);
|
|
1339
|
+
}
|
|
1340
|
+
async function top10SavePercentage5v5(season, gameType, sortBy) {
|
|
1341
|
+
const Parser = BaseParams.merge({
|
|
1342
|
+
sortBy: withDefault(SavePercentage5v5Sort, "5v5-SV%")
|
|
1343
|
+
});
|
|
1344
|
+
const parsed = Parser({ season, gameType, sortBy });
|
|
1345
|
+
if (isParseError(parsed))
|
|
1346
|
+
return invalidParams(parsed, goaliesPaths.top10.savePercentage5v5);
|
|
1347
|
+
const path = resolvePath(goaliesPaths.top10.savePercentage5v5, parsed);
|
|
1348
|
+
return nhlClient.get(path);
|
|
1349
|
+
}
|
|
1350
|
+
async function top10SaveLocation(season, gameType, category, sortBy) {
|
|
1351
|
+
const Parser = BaseParams.merge({
|
|
1352
|
+
category: withDefault(SaveLocationCategory, "SV%"),
|
|
1353
|
+
sortBy: withDefault(SaveLocationSort, "ALL")
|
|
1354
|
+
});
|
|
1355
|
+
const parsed = Parser({
|
|
1356
|
+
season,
|
|
1357
|
+
gameType,
|
|
1358
|
+
category,
|
|
1359
|
+
sortBy
|
|
1360
|
+
});
|
|
1361
|
+
if (isParseError(parsed))
|
|
1362
|
+
return invalidParams(parsed, goaliesPaths.top10.saveLocation);
|
|
1363
|
+
const path = resolvePath(goaliesPaths.top10.saveLocation, parsed);
|
|
1364
|
+
return nhlClient.get(path);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// src/api/edge-adv/skaters.ts
|
|
1368
|
+
var skaters_exports = {};
|
|
1369
|
+
__export(skaters_exports, {
|
|
1370
|
+
comparison: () => comparison,
|
|
1371
|
+
detail: () => detail,
|
|
1372
|
+
leaders: () => leaders2,
|
|
1373
|
+
shotLocation: () => shotLocation,
|
|
1374
|
+
shotSpeed: () => shotSpeed,
|
|
1375
|
+
skatingDistance: () => skatingDistance,
|
|
1376
|
+
skatingSpeed: () => skatingSpeed,
|
|
1377
|
+
top10: () => top102,
|
|
1378
|
+
zoneTime: () => zoneTime
|
|
1379
|
+
});
|
|
1380
|
+
async function detail(playerId, season, gameType) {
|
|
1381
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1382
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.player);
|
|
1383
|
+
const path = resolvePath(skatersPaths.player, parsed);
|
|
1384
|
+
return nhlClient.get(path);
|
|
1385
|
+
}
|
|
1386
|
+
async function shotLocation(playerId, season, gameType) {
|
|
1387
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1388
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.shotLocation);
|
|
1389
|
+
const path = resolvePath(skatersPaths.shotLocation, parsed);
|
|
1390
|
+
return nhlClient.get(path);
|
|
1391
|
+
}
|
|
1392
|
+
async function shotSpeed(playerId, season, gameType) {
|
|
1393
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1394
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.shotSpeed);
|
|
1395
|
+
const path = resolvePath(skatersPaths.shotSpeed, parsed);
|
|
1396
|
+
return nhlClient.get(path);
|
|
1397
|
+
}
|
|
1398
|
+
async function skatingDistance(playerId, season, gameType) {
|
|
1399
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1400
|
+
if (isParseError(parsed))
|
|
1401
|
+
return invalidParams(parsed, skatersPaths.skatingDistance);
|
|
1402
|
+
const path = resolvePath(skatersPaths.skatingDistance, parsed);
|
|
1403
|
+
return nhlClient.get(path);
|
|
1404
|
+
}
|
|
1405
|
+
async function skatingSpeed(playerId, season, gameType) {
|
|
1406
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1407
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.skatingSpeed);
|
|
1408
|
+
const path = resolvePath(skatersPaths.skatingSpeed, parsed);
|
|
1409
|
+
return nhlClient.get(path);
|
|
1410
|
+
}
|
|
1411
|
+
async function zoneTime(playerId, season, gameType) {
|
|
1412
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1413
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.zoneTime);
|
|
1414
|
+
const path = resolvePath(skatersPaths.zoneTime, parsed);
|
|
1415
|
+
return nhlClient.get(path);
|
|
1416
|
+
}
|
|
1417
|
+
async function comparison(playerId, season, gameType) {
|
|
1418
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1419
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.compare);
|
|
1420
|
+
const path = resolvePath(skatersPaths.compare, parsed);
|
|
1421
|
+
return nhlClient.get(path);
|
|
1422
|
+
}
|
|
1423
|
+
async function leaders2(season, gameType) {
|
|
1424
|
+
const parsed = BaseParams({ season, gameType });
|
|
1425
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.leaders);
|
|
1426
|
+
const path = resolvePath(skatersPaths.leaders, parsed);
|
|
1427
|
+
return nhlClient.get(path);
|
|
1428
|
+
}
|
|
1429
|
+
var top102 = {
|
|
1430
|
+
distance: top10Distance,
|
|
1431
|
+
shotLocation: top10ShotLocation,
|
|
1432
|
+
shotSpeed: top10ShotSpeed,
|
|
1433
|
+
speed: top10Speed,
|
|
1434
|
+
zoneTime: top10ZoneTime
|
|
1435
|
+
};
|
|
1436
|
+
async function top10Distance(season, gameType, position, strength, sortBy) {
|
|
1437
|
+
const parsed = top10Params.merge({
|
|
1438
|
+
sortBy: withDefault(SkatingDistanceSort, "TOTAL")
|
|
1439
|
+
})({
|
|
1440
|
+
season,
|
|
1441
|
+
gameType,
|
|
1442
|
+
position,
|
|
1443
|
+
strength,
|
|
1444
|
+
sortBy
|
|
1445
|
+
});
|
|
1446
|
+
if (isParseError(parsed))
|
|
1447
|
+
return invalidParams(parsed, skatersPaths.top10.skatingDistance);
|
|
1448
|
+
const path = resolvePath(skatersPaths.top10.skatingDistance, parsed);
|
|
1449
|
+
return nhlClient.get(path);
|
|
1450
|
+
}
|
|
1451
|
+
async function top10ShotLocation(season, gameType, position, category, sortBy) {
|
|
1452
|
+
const parsed = top10Params.merge({
|
|
1453
|
+
category: withDefault(ShotLocationCategory, "G"),
|
|
1454
|
+
sortBy: withDefault(ShotLocationSort, "ALL")
|
|
1455
|
+
})({
|
|
1456
|
+
season,
|
|
1457
|
+
gameType,
|
|
1458
|
+
position,
|
|
1459
|
+
category,
|
|
1460
|
+
sortBy
|
|
1461
|
+
});
|
|
1462
|
+
if (isParseError(parsed))
|
|
1463
|
+
return invalidParams(parsed, skatersPaths.top10.shotLocation);
|
|
1464
|
+
const path = resolvePath(skatersPaths.top10.shotLocation, parsed);
|
|
1465
|
+
return nhlClient.get(path);
|
|
1466
|
+
}
|
|
1467
|
+
async function top10ShotSpeed(season, gameType, position, sortBy) {
|
|
1468
|
+
const parsed = top10Params.merge({
|
|
1469
|
+
sortBy: withDefault(ShotSpeedSort, "MAX")
|
|
1470
|
+
})({
|
|
1471
|
+
season,
|
|
1472
|
+
gameType,
|
|
1473
|
+
position,
|
|
1474
|
+
sortBy
|
|
1475
|
+
});
|
|
1476
|
+
if (isParseError(parsed))
|
|
1477
|
+
return invalidParams(parsed, skatersPaths.top10.shotSpeed);
|
|
1478
|
+
const path = resolvePath(skatersPaths.top10.shotSpeed, parsed);
|
|
1479
|
+
return nhlClient.get(path);
|
|
1480
|
+
}
|
|
1481
|
+
async function top10Speed(season, gameType, position, sortBy) {
|
|
1482
|
+
const parsed = top10Params.merge({
|
|
1483
|
+
sortBy: withDefault(SkatingSpeedSort, "TOP")
|
|
1484
|
+
})({
|
|
1485
|
+
season,
|
|
1486
|
+
gameType,
|
|
1487
|
+
position,
|
|
1488
|
+
sortBy
|
|
1489
|
+
});
|
|
1490
|
+
if (isParseError(parsed))
|
|
1491
|
+
return invalidParams(parsed, skatersPaths.top10.skatingSpeed);
|
|
1492
|
+
const path = resolvePath(skatersPaths.top10.skatingSpeed, parsed);
|
|
1493
|
+
return nhlClient.get(path);
|
|
1494
|
+
}
|
|
1495
|
+
async function top10ZoneTime(season, gameType, position, strength, sortBy) {
|
|
1496
|
+
const parsed = top10Params.merge({
|
|
1497
|
+
sortBy: withDefault(ZoneTimeSort, "OZ")
|
|
1498
|
+
})({
|
|
1499
|
+
season,
|
|
1500
|
+
gameType,
|
|
1501
|
+
position,
|
|
1502
|
+
strength,
|
|
1503
|
+
sortBy
|
|
1504
|
+
});
|
|
1505
|
+
if (isParseError(parsed)) return invalidParams(parsed, skatersPaths.top10.zoneTime);
|
|
1506
|
+
const path = resolvePath(skatersPaths.top10.zoneTime, parsed);
|
|
1507
|
+
return nhlClient.get(path);
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
// src/api/edge-adv/summary.ts
|
|
1511
|
+
async function byTheNumbers() {
|
|
1512
|
+
return nhlClient.get(summaryPaths.byTheNumbers);
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// src/api/edge-adv/teams.ts
|
|
1516
|
+
var teams_exports = {};
|
|
1517
|
+
__export(teams_exports, {
|
|
1518
|
+
compare: () => compare2,
|
|
1519
|
+
leaders: () => leaders3,
|
|
1520
|
+
shotLocation: () => shotLocation2,
|
|
1521
|
+
shotSpeed: () => shotSpeed2,
|
|
1522
|
+
skatingDistance: () => skatingDistance2,
|
|
1523
|
+
skatingSpeed: () => skatingSpeed2,
|
|
1524
|
+
stats: () => stats,
|
|
1525
|
+
top10: () => top103,
|
|
1526
|
+
zoneTime: () => zoneTime2
|
|
1527
|
+
});
|
|
1528
|
+
async function stats(teamId, season, gameType) {
|
|
1529
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1530
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.stats);
|
|
1531
|
+
const path = resolvePath(teamsPaths.stats, parsed);
|
|
1532
|
+
return nhlClient.get(path);
|
|
1533
|
+
}
|
|
1534
|
+
async function compare2(teamId, season, gameType) {
|
|
1535
|
+
gameType ??= "REG";
|
|
1536
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1537
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.compare);
|
|
1538
|
+
const path = resolvePath(teamsPaths.compare, parsed);
|
|
1539
|
+
return nhlClient.get(path);
|
|
1540
|
+
}
|
|
1541
|
+
async function leaders3(season, gameType) {
|
|
1542
|
+
const parsed = BaseParams({ season, gameType });
|
|
1543
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.leaders);
|
|
1544
|
+
const path = resolvePath(teamsPaths.leaders, parsed);
|
|
1545
|
+
return nhlClient.get(path);
|
|
1546
|
+
}
|
|
1547
|
+
async function shotLocation2(teamId, season, gameType) {
|
|
1548
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1549
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.shotLocation);
|
|
1550
|
+
const path = resolvePath(teamsPaths.shotLocation, parsed);
|
|
1551
|
+
return nhlClient.get(path);
|
|
1552
|
+
}
|
|
1553
|
+
async function shotSpeed2(teamId, season, gameType) {
|
|
1554
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1555
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.shotSpeed);
|
|
1556
|
+
const path = resolvePath(teamsPaths.shotSpeed, parsed);
|
|
1557
|
+
return nhlClient.get(path);
|
|
1558
|
+
}
|
|
1559
|
+
async function skatingDistance2(teamId, season, gameType) {
|
|
1560
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1561
|
+
if (isParseError(parsed))
|
|
1562
|
+
return invalidParams(parsed, teamsPaths.skatingDistance);
|
|
1563
|
+
const path = resolvePath(teamsPaths.skatingDistance, parsed);
|
|
1564
|
+
return nhlClient.get(path);
|
|
1565
|
+
}
|
|
1566
|
+
async function skatingSpeed2(teamId, season, gameType) {
|
|
1567
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1568
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.skatingSpeed);
|
|
1569
|
+
const path = resolvePath(teamsPaths.skatingSpeed, parsed);
|
|
1570
|
+
return nhlClient.get(path);
|
|
1571
|
+
}
|
|
1572
|
+
async function zoneTime2(teamId, season, gameType) {
|
|
1573
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1574
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.zoneTime);
|
|
1575
|
+
const path = resolvePath(teamsPaths.zoneTime, parsed);
|
|
1576
|
+
return nhlClient.get(path);
|
|
1577
|
+
}
|
|
1578
|
+
var top103 = {
|
|
1579
|
+
shotLocation: top10ShotLocation2,
|
|
1580
|
+
shotSpeed: top10ShotSpeed2,
|
|
1581
|
+
skatingDistance: top10SkatingDistance,
|
|
1582
|
+
skatingSpeed: top10SkatingSpeed,
|
|
1583
|
+
zoneTime: top10ZoneTime2
|
|
1584
|
+
};
|
|
1585
|
+
async function top10ShotLocation2(season, gameType, position, category, sortBy) {
|
|
1586
|
+
const Parser = BaseParams.merge({
|
|
1587
|
+
position: withDefault(PositionFilter, "ALL"),
|
|
1588
|
+
category: withDefault(ShotLocationCategory, "G"),
|
|
1589
|
+
sortBy: withDefault(ShotLocationSort, "ALL")
|
|
1590
|
+
});
|
|
1591
|
+
const parsed = Parser({
|
|
1592
|
+
season,
|
|
1593
|
+
gameType,
|
|
1594
|
+
position,
|
|
1595
|
+
category,
|
|
1596
|
+
sortBy
|
|
1597
|
+
});
|
|
1598
|
+
if (isParseError(parsed))
|
|
1599
|
+
return invalidParams(parsed, teamsPaths.top10.shotLocation);
|
|
1600
|
+
const path = resolvePath(teamsPaths.top10.shotLocation, parsed);
|
|
1601
|
+
return nhlClient.get(path);
|
|
1602
|
+
}
|
|
1603
|
+
async function top10ShotSpeed2(season, gameType, position, sortBy) {
|
|
1604
|
+
const Parser = BaseParams.merge({
|
|
1605
|
+
position: withDefault(PositionFilter, "ALL"),
|
|
1606
|
+
sortBy: withDefault(ShotSpeedSort, "MAX")
|
|
1607
|
+
});
|
|
1608
|
+
const parsed = Parser({
|
|
1609
|
+
season,
|
|
1610
|
+
gameType,
|
|
1611
|
+
position,
|
|
1612
|
+
sortBy
|
|
1613
|
+
});
|
|
1614
|
+
if (isParseError(parsed))
|
|
1615
|
+
return invalidParams(parsed, teamsPaths.top10.shotSpeed);
|
|
1616
|
+
const path = resolvePath(teamsPaths.top10.shotSpeed, parsed);
|
|
1617
|
+
return nhlClient.get(path);
|
|
1618
|
+
}
|
|
1619
|
+
async function top10SkatingDistance(season, gameType, position, strength, sortBy) {
|
|
1620
|
+
const Parser = BaseParams.merge({
|
|
1621
|
+
position: withDefault(PositionFilter, "ALL"),
|
|
1622
|
+
strength: withDefault(SkatersStrength, "ALL"),
|
|
1623
|
+
sortBy: withDefault(SkatingDistanceSort, "TOTAL")
|
|
1624
|
+
});
|
|
1625
|
+
const parsed = Parser({
|
|
1626
|
+
season,
|
|
1627
|
+
gameType,
|
|
1628
|
+
position,
|
|
1629
|
+
strength,
|
|
1630
|
+
sortBy
|
|
1631
|
+
});
|
|
1632
|
+
if (isParseError(parsed))
|
|
1633
|
+
return invalidParams(parsed, teamsPaths.top10.skatingDistance);
|
|
1634
|
+
const path = resolvePath(teamsPaths.top10.skatingDistance, parsed);
|
|
1635
|
+
return nhlClient.get(path);
|
|
1636
|
+
}
|
|
1637
|
+
async function top10SkatingSpeed(season, gameType, position, sortBy) {
|
|
1638
|
+
const Parser = BaseParams.merge({
|
|
1639
|
+
position: withDefault(PositionFilter, "ALL"),
|
|
1640
|
+
sortBy: withDefault(SkatingSpeedSort, "TOP")
|
|
1641
|
+
});
|
|
1642
|
+
const parsed = Parser({
|
|
1643
|
+
season,
|
|
1644
|
+
gameType,
|
|
1645
|
+
position,
|
|
1646
|
+
sortBy
|
|
1647
|
+
});
|
|
1648
|
+
if (isParseError(parsed))
|
|
1649
|
+
return invalidParams(parsed, teamsPaths.top10.skatingSpeed);
|
|
1650
|
+
const path = resolvePath(teamsPaths.top10.skatingSpeed, parsed);
|
|
1651
|
+
return nhlClient.get(path);
|
|
1652
|
+
}
|
|
1653
|
+
async function top10ZoneTime2(season, gameType, strength, sortBy) {
|
|
1654
|
+
const Parser = BaseParams.merge({
|
|
1655
|
+
strength: withDefault(SkatersStrength, "ALL"),
|
|
1656
|
+
sortBy: withDefault(ZoneTimeSort, "OZ")
|
|
1657
|
+
});
|
|
1658
|
+
const parsed = Parser({
|
|
1659
|
+
season,
|
|
1660
|
+
gameType,
|
|
1661
|
+
strength,
|
|
1662
|
+
sortBy
|
|
1663
|
+
});
|
|
1664
|
+
if (isParseError(parsed)) return invalidParams(parsed, teamsPaths.top10.zoneTime);
|
|
1665
|
+
const path = resolvePath(teamsPaths.top10.zoneTime, parsed);
|
|
1666
|
+
return nhlClient.get(path);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// src/api/edge-stats/index.ts
|
|
1670
|
+
var edge_stats_exports = {};
|
|
1671
|
+
__export(edge_stats_exports, {
|
|
1672
|
+
goalies: () => goalies_exports2,
|
|
1673
|
+
misc: () => misc_exports,
|
|
1674
|
+
season: () => season_game_exports,
|
|
1675
|
+
skaters: () => skaters_exports2,
|
|
1676
|
+
teams: () => teams_exports2
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
// src/api/edge-stats/goalies.ts
|
|
1680
|
+
var goalies_exports2 = {};
|
|
1681
|
+
__export(goalies_exports2, {
|
|
1682
|
+
getLeaders: () => getLeaders,
|
|
1683
|
+
getMilestones: () => getMilestones,
|
|
1684
|
+
getStats: () => getStats,
|
|
1685
|
+
getStatsWithBuilder: () => getStatsWithBuilder,
|
|
1686
|
+
getStatsWithFilters: () => getStatsWithFilters,
|
|
1687
|
+
getStatsWithParams: () => getStatsWithParams
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
// src/utils/cayenne-query-builder.ts
|
|
1691
|
+
var CayenneQueryBuilder = class {
|
|
1692
|
+
conditions = [];
|
|
1693
|
+
currentLogicalOp = "and";
|
|
1694
|
+
groupStack = [];
|
|
1695
|
+
/**
|
|
1696
|
+
* Start a new logical group
|
|
1697
|
+
* All subsequent conditions will be added to this group until endGroup() is called
|
|
1698
|
+
* @returns This builder instance for chaining
|
|
1699
|
+
* @example
|
|
1700
|
+
* builder
|
|
1701
|
+
* .equals('field1', 'value1')
|
|
1702
|
+
* .group()
|
|
1703
|
+
* .equals('field2', 'value2')
|
|
1704
|
+
* .or()
|
|
1705
|
+
* .equals('field3', 'value3')
|
|
1706
|
+
* .endGroup()
|
|
1707
|
+
* // Generates: "field1=value1 and (field2=value2 or field3=value3)"
|
|
1708
|
+
*/
|
|
1709
|
+
group() {
|
|
1710
|
+
this.groupStack.push({
|
|
1711
|
+
conditions: this.conditions,
|
|
1712
|
+
logicalOp: this.currentLogicalOp
|
|
1713
|
+
});
|
|
1714
|
+
this.conditions = [];
|
|
1715
|
+
this.currentLogicalOp = "and";
|
|
1716
|
+
return this;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* End the current logical group
|
|
1720
|
+
* @returns This builder instance for chaining
|
|
1721
|
+
* @throws Error if there's no open group
|
|
1722
|
+
*/
|
|
1723
|
+
endGroup() {
|
|
1724
|
+
if (this.groupStack.length === 0) {
|
|
1725
|
+
throw new Error("Cannot end group: no open group found");
|
|
1726
|
+
}
|
|
1727
|
+
const groupConditions = this.conditions;
|
|
1728
|
+
const parent = this.groupStack.pop();
|
|
1729
|
+
if (!parent) {
|
|
1730
|
+
throw new Error("Failed to restore parent context");
|
|
1731
|
+
}
|
|
1732
|
+
this.conditions = parent.conditions;
|
|
1733
|
+
const groupLogicalOp = parent.logicalOp;
|
|
1734
|
+
this.currentLogicalOp = parent.logicalOp;
|
|
1735
|
+
const group = {
|
|
1736
|
+
type: "group",
|
|
1737
|
+
conditions: groupConditions,
|
|
1738
|
+
logicalOp: groupLogicalOp
|
|
1739
|
+
};
|
|
1740
|
+
this.conditions.push(group);
|
|
1741
|
+
return this;
|
|
1742
|
+
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Set the logical operator to AND for subsequent conditions
|
|
1745
|
+
* @returns This builder instance for chaining
|
|
1746
|
+
*/
|
|
1747
|
+
and() {
|
|
1748
|
+
this.currentLogicalOp = "and";
|
|
1749
|
+
return this;
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Set the logical operator to OR for subsequent conditions
|
|
1753
|
+
* @returns This builder instance for chaining
|
|
1754
|
+
*/
|
|
1755
|
+
or() {
|
|
1756
|
+
this.currentLogicalOp = "or";
|
|
1757
|
+
return this;
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Add an equality condition
|
|
1761
|
+
* @param field - The field name to filter on
|
|
1762
|
+
* @param value - The value to match
|
|
1763
|
+
* @returns This builder instance for chaining
|
|
1764
|
+
*/
|
|
1765
|
+
equals(field, value) {
|
|
1766
|
+
this.conditions.push({
|
|
1767
|
+
field,
|
|
1768
|
+
operator: "=",
|
|
1769
|
+
value,
|
|
1770
|
+
logicalOp: this.currentLogicalOp
|
|
1771
|
+
});
|
|
1772
|
+
return this;
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Add a not-equal condition
|
|
1776
|
+
* @param field - The field name to filter on
|
|
1777
|
+
* @param value - The value to exclude
|
|
1778
|
+
* @returns This builder instance for chaining
|
|
1779
|
+
*/
|
|
1780
|
+
notEquals(field, value) {
|
|
1781
|
+
this.conditions.push({
|
|
1782
|
+
field,
|
|
1783
|
+
operator: "!=",
|
|
1784
|
+
value,
|
|
1785
|
+
logicalOp: this.currentLogicalOp
|
|
1786
|
+
});
|
|
1787
|
+
return this;
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Add a less-than condition
|
|
1791
|
+
* @param field - The field name to filter on
|
|
1792
|
+
* @param value - The upper bound (exclusive)
|
|
1793
|
+
* @returns This builder instance for chaining
|
|
1794
|
+
*/
|
|
1795
|
+
lessThan(field, value) {
|
|
1796
|
+
this.conditions.push({
|
|
1797
|
+
field,
|
|
1798
|
+
operator: "<",
|
|
1799
|
+
value,
|
|
1800
|
+
logicalOp: this.currentLogicalOp
|
|
1801
|
+
});
|
|
1802
|
+
return this;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Add a greater-than condition
|
|
1806
|
+
* @param field - The field name to filter on
|
|
1807
|
+
* @param value - The lower bound (exclusive)
|
|
1808
|
+
* @returns This builder instance for chaining
|
|
1809
|
+
*/
|
|
1810
|
+
greaterThan(field, value) {
|
|
1811
|
+
this.conditions.push({
|
|
1812
|
+
field,
|
|
1813
|
+
operator: ">",
|
|
1814
|
+
value,
|
|
1815
|
+
logicalOp: this.currentLogicalOp
|
|
1816
|
+
});
|
|
1817
|
+
return this;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Add a less-than-or-equal condition
|
|
1821
|
+
* @param field - The field name to filter on
|
|
1822
|
+
* @param value - The upper bound (inclusive)
|
|
1823
|
+
* @returns This builder instance for chaining
|
|
1824
|
+
*/
|
|
1825
|
+
lessThanOrEqual(field, value) {
|
|
1826
|
+
this.conditions.push({
|
|
1827
|
+
field,
|
|
1828
|
+
operator: "<=",
|
|
1829
|
+
value,
|
|
1830
|
+
logicalOp: this.currentLogicalOp
|
|
1831
|
+
});
|
|
1832
|
+
return this;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Add a greater-than-or-equal condition
|
|
1836
|
+
* @param field - The field name to filter on
|
|
1837
|
+
* @param value - The lower bound (inclusive)
|
|
1838
|
+
* @returns This builder instance for chaining
|
|
1839
|
+
*/
|
|
1840
|
+
greaterThanOrEqual(field, value) {
|
|
1841
|
+
this.conditions.push({
|
|
1842
|
+
field,
|
|
1843
|
+
operator: ">=",
|
|
1844
|
+
value,
|
|
1845
|
+
logicalOp: this.currentLogicalOp
|
|
1846
|
+
});
|
|
1847
|
+
return this;
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Add an IN condition to match multiple values
|
|
1851
|
+
* @param field - The field name to filter on
|
|
1852
|
+
* @param values - Array of values to match against
|
|
1853
|
+
* @returns This builder instance for chaining
|
|
1854
|
+
* @example
|
|
1855
|
+
* builder.in('playerId', [8476791, 8477933, 8478402])
|
|
1856
|
+
* // Generates: "playerId in (8476791, 8477933, 8478402)"
|
|
1857
|
+
*/
|
|
1858
|
+
in(field, values) {
|
|
1859
|
+
if (values.length === 0) {
|
|
1860
|
+
throw new Error("IN condition requires at least one value");
|
|
1861
|
+
}
|
|
1862
|
+
this.conditions.push({
|
|
1863
|
+
field,
|
|
1864
|
+
operator: "in",
|
|
1865
|
+
value: values,
|
|
1866
|
+
logicalOp: this.currentLogicalOp
|
|
1867
|
+
});
|
|
1868
|
+
return this;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Add a LIKE condition for pattern matching
|
|
1872
|
+
* @param field - The field name to filter on
|
|
1873
|
+
* @param pattern - The pattern to match (supports % for wildcards)
|
|
1874
|
+
* @returns This builder instance for chaining
|
|
1875
|
+
* @example
|
|
1876
|
+
* builder.like('playerName', '%McDavid%')
|
|
1877
|
+
* // Generates: "playerName like '%McDavid%'"
|
|
1878
|
+
*/
|
|
1879
|
+
like(field, pattern) {
|
|
1880
|
+
this.conditions.push({
|
|
1881
|
+
field,
|
|
1882
|
+
operator: "like",
|
|
1883
|
+
value: pattern,
|
|
1884
|
+
logicalOp: this.currentLogicalOp
|
|
1885
|
+
});
|
|
1886
|
+
return this;
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Add a raw condition string
|
|
1890
|
+
* Useful for complex expressions or unsupported operators
|
|
1891
|
+
* @param condition - The raw condition string (e.g., "playerId=8476791")
|
|
1892
|
+
* @returns This builder instance for chaining
|
|
1893
|
+
*/
|
|
1894
|
+
raw(condition) {
|
|
1895
|
+
this.conditions.push({
|
|
1896
|
+
field: "__raw__",
|
|
1897
|
+
operator: "=",
|
|
1898
|
+
value: condition,
|
|
1899
|
+
logicalOp: this.currentLogicalOp
|
|
1900
|
+
});
|
|
1901
|
+
return this;
|
|
1902
|
+
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Build the cayenneExp string
|
|
1905
|
+
* @returns The formatted cayenneExp string ready for API consumption
|
|
1906
|
+
*/
|
|
1907
|
+
build() {
|
|
1908
|
+
if (this.groupStack.length > 0) {
|
|
1909
|
+
throw new Error(
|
|
1910
|
+
`Cannot build: ${this.groupStack.length} group(s) still open. Call endGroup() to close them.`
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
const buildExpression = (items, depth = 0) => {
|
|
1914
|
+
return items.map((item, index) => {
|
|
1915
|
+
let expr = "";
|
|
1916
|
+
if ("type" in item && item.type === "group") {
|
|
1917
|
+
const groupExpr = buildExpression(
|
|
1918
|
+
item.conditions,
|
|
1919
|
+
depth + 1
|
|
1920
|
+
);
|
|
1921
|
+
expr = `(${groupExpr})`;
|
|
1922
|
+
} else if ("field" in item) {
|
|
1923
|
+
const condition = item;
|
|
1924
|
+
if (condition.field === "__raw__") {
|
|
1925
|
+
expr = String(condition.value);
|
|
1926
|
+
} else if (condition.operator === "in") {
|
|
1927
|
+
const values = Array.isArray(condition.value) ? condition.value.join(", ") : condition.value;
|
|
1928
|
+
expr = `${condition.field} in (${values})`;
|
|
1929
|
+
} else if (condition.operator === "like") {
|
|
1930
|
+
expr = `${condition.field} like '${condition.value}'`;
|
|
1931
|
+
} else {
|
|
1932
|
+
expr = `${condition.field}${condition.operator}${condition.value}`;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
if (index < items.length - 1) {
|
|
1936
|
+
const nextItem = items[index + 1];
|
|
1937
|
+
if (nextItem) {
|
|
1938
|
+
const nextLogicalOp = ("logicalOp" in nextItem ? nextItem.logicalOp : void 0) || "and";
|
|
1939
|
+
expr += ` ${nextLogicalOp}`;
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
return expr;
|
|
1943
|
+
}).join(" ");
|
|
1944
|
+
};
|
|
1945
|
+
return buildExpression(this.conditions);
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Clear all conditions
|
|
1949
|
+
* @returns This builder instance for chaining
|
|
1950
|
+
*/
|
|
1951
|
+
clear() {
|
|
1952
|
+
this.conditions = [];
|
|
1953
|
+
return this;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Get the number of conditions currently in the builder
|
|
1957
|
+
*/
|
|
1958
|
+
count() {
|
|
1959
|
+
return this.conditions.length;
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
function createCayenneQuery() {
|
|
1963
|
+
return new CayenneQueryBuilder();
|
|
1964
|
+
}
|
|
1965
|
+
function buildCayenneExp(filters) {
|
|
1966
|
+
const builder = new CayenneQueryBuilder();
|
|
1967
|
+
Object.entries(filters).forEach(([field, value]) => {
|
|
1968
|
+
builder.equals(field, value);
|
|
1969
|
+
});
|
|
1970
|
+
return builder.build();
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
// src/api/edge-stats/paths.ts
|
|
1974
|
+
var dataPaths = {
|
|
1975
|
+
/** Goalie-related statistics and reports. */
|
|
1976
|
+
goalie: {
|
|
1977
|
+
/** Goalie leader boards by stat category. */
|
|
1978
|
+
leaders: {
|
|
1979
|
+
/** Goals-against average leaders. */
|
|
1980
|
+
gaa: "{lang}/leaders/goalies/gaa",
|
|
1981
|
+
/** Save percentage leaders. */
|
|
1982
|
+
savePctg: "{lang}/leaders/goalies/savePctg",
|
|
1983
|
+
/** Shutouts leaders. */
|
|
1984
|
+
shutouts: "{lang}/leaders/goalies/shutouts"
|
|
1985
|
+
},
|
|
1986
|
+
/** Goalie statistical reports. */
|
|
1987
|
+
report: "{lang}/goalie/{report}",
|
|
1988
|
+
/** Goalie career milestones. */
|
|
1989
|
+
milestones: "{lang}/milestones/goalies"
|
|
1990
|
+
},
|
|
1991
|
+
/** Skater/player-related statistics and reports. */
|
|
1992
|
+
skater: {
|
|
1993
|
+
/** Player directory and information. */
|
|
1994
|
+
players: "{lang}/players",
|
|
1995
|
+
/** Skater leader boards by stat category. */
|
|
1996
|
+
leaders: {
|
|
1997
|
+
/** Assists leaders. */
|
|
1998
|
+
assists: "{lang}/leaders/skaters/assists",
|
|
1999
|
+
/** Goals leaders. */
|
|
2000
|
+
goals: "{lang}/leaders/skaters/goals",
|
|
2001
|
+
/** Points leaders. */
|
|
2002
|
+
points: "{lang}/leaders/skaters/points"
|
|
2003
|
+
},
|
|
2004
|
+
/** Skater career milestones. */
|
|
2005
|
+
milestones: "{lang}/milestones/skaters",
|
|
2006
|
+
/** Skater statistical reports. */
|
|
2007
|
+
report: "{lang}/skater/{report}"
|
|
2008
|
+
},
|
|
2009
|
+
/** Team-related statistics and reports. */
|
|
2010
|
+
team: {
|
|
2011
|
+
/** All teams data. */
|
|
2012
|
+
all: "{lang}/team",
|
|
2013
|
+
/** Team data by team ID. */
|
|
2014
|
+
byId: "{lang}/team/id/{teamId}",
|
|
2015
|
+
/** Team statistical reports. */
|
|
2016
|
+
report: "{lang}/team/{report}"
|
|
2017
|
+
},
|
|
2018
|
+
/** Season-related data. */
|
|
2019
|
+
season: "{lang}/season",
|
|
2020
|
+
/** Game-related data. */
|
|
2021
|
+
game: "{lang}/game",
|
|
2022
|
+
/** Draft-related data. */
|
|
2023
|
+
draft: "{lang}/draft",
|
|
2024
|
+
/** Configuration data for skater, goalie, and team reports. */
|
|
2025
|
+
config: "{lang}/config",
|
|
2026
|
+
/** Country data. */
|
|
2027
|
+
countries: "{lang}/country",
|
|
2028
|
+
/** Shift chart data. */
|
|
2029
|
+
shiftCharts: "{lang}/shiftcharts",
|
|
2030
|
+
/** Glossary data. */
|
|
2031
|
+
glossary: "{lang}/glossary",
|
|
2032
|
+
/** Franchise data. */
|
|
2033
|
+
franchises: "{lang}/franchise"
|
|
2034
|
+
};
|
|
2035
|
+
|
|
2036
|
+
// src/api/edge-stats/query.ts
|
|
2037
|
+
function reportParams(params = {}) {
|
|
2038
|
+
return { ...params, cayenneExp: params.cayenneExp ?? "" };
|
|
2039
|
+
}
|
|
2040
|
+
function filterParams(filters = {}, sorting = {}, pagination = {}) {
|
|
2041
|
+
const conditions = {};
|
|
2042
|
+
for (const [field, value] of Object.entries(filters)) {
|
|
2043
|
+
if (value !== void 0 && value !== "") conditions[field] = value;
|
|
2044
|
+
}
|
|
2045
|
+
const params = {
|
|
2046
|
+
cayenneExp: buildCayenneExp(conditions)
|
|
2047
|
+
};
|
|
2048
|
+
if (sorting.sortBy) params.sort = sorting.sortBy;
|
|
2049
|
+
if (sorting.direction) params.dir = sorting.direction;
|
|
2050
|
+
if (pagination.limit !== void 0) params.limit = pagination.limit;
|
|
2051
|
+
if (pagination.start !== void 0) params.start = pagination.start;
|
|
2052
|
+
return params;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
// src/api/edge-stats/goalies.ts
|
|
2056
|
+
async function getLeaders(statCategory, params = {}, lang = config.language) {
|
|
2057
|
+
const path = resolvePath(dataPaths.goalie.leaders[statCategory], { lang });
|
|
2058
|
+
return edgeStatsClient.get(path, params);
|
|
2059
|
+
}
|
|
2060
|
+
async function getStats(report = "summary", params = {}, lang = config.language) {
|
|
2061
|
+
const path = resolvePath(dataPaths.goalie.report, { lang, report });
|
|
2062
|
+
return edgeStatsClient.get(
|
|
2063
|
+
path,
|
|
2064
|
+
reportParams(params)
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
async function getStatsWithParams(report, params, lang = config.language) {
|
|
2068
|
+
return getStats(report, params, lang);
|
|
2069
|
+
}
|
|
2070
|
+
async function getStatsWithBuilder(report, buildQuery, lang = config.language) {
|
|
2071
|
+
return getStats(report, buildQuery(new CayenneQueryBuilder()), lang);
|
|
2072
|
+
}
|
|
2073
|
+
async function getStatsWithFilters(report, filters, sorting, pagination, lang = config.language) {
|
|
2074
|
+
return getStats(
|
|
2075
|
+
report,
|
|
2076
|
+
filterParams(filters, sorting, pagination),
|
|
2077
|
+
lang
|
|
2078
|
+
);
|
|
2079
|
+
}
|
|
2080
|
+
async function getMilestones(lang = config.language) {
|
|
2081
|
+
const path = resolvePath(dataPaths.goalie.milestones, { lang });
|
|
2082
|
+
return edgeStatsClient.get(path);
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
// src/api/edge-stats/misc.ts
|
|
2086
|
+
var misc_exports = {};
|
|
2087
|
+
__export(misc_exports, {
|
|
2088
|
+
getConfig: () => getConfig,
|
|
2089
|
+
getCountries: () => getCountries,
|
|
2090
|
+
getFranchises: () => getFranchises,
|
|
2091
|
+
getGlossary: () => getGlossary
|
|
2092
|
+
});
|
|
2093
|
+
async function getConfig(lang = config.language) {
|
|
2094
|
+
const path = resolvePath(dataPaths.config, { lang });
|
|
2095
|
+
return edgeStatsClient.get(path);
|
|
2096
|
+
}
|
|
2097
|
+
async function getCountries(lang = config.language) {
|
|
2098
|
+
const path = resolvePath(dataPaths.countries, { lang });
|
|
2099
|
+
return edgeStatsClient.get(path);
|
|
2100
|
+
}
|
|
2101
|
+
async function getGlossary(lang = config.language) {
|
|
2102
|
+
const path = resolvePath(dataPaths.glossary, { lang });
|
|
2103
|
+
return edgeStatsClient.get(path);
|
|
2104
|
+
}
|
|
2105
|
+
async function getFranchises(lang = config.language) {
|
|
2106
|
+
const path = resolvePath(dataPaths.franchises, { lang });
|
|
2107
|
+
return edgeStatsClient.get(path);
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
// src/api/edge-stats/season-game.ts
|
|
2111
|
+
var season_game_exports = {};
|
|
2112
|
+
__export(season_game_exports, {
|
|
2113
|
+
getDraft: () => getDraft,
|
|
2114
|
+
getGames: () => getGames,
|
|
2115
|
+
getSeasons: () => getSeasons,
|
|
2116
|
+
getShiftChart: () => getShiftChart
|
|
2117
|
+
});
|
|
2118
|
+
async function getSeasons(lang = config.language) {
|
|
2119
|
+
const path = resolvePath(dataPaths.season, { lang });
|
|
2120
|
+
return edgeStatsClient.get(path);
|
|
2121
|
+
}
|
|
2122
|
+
async function getGames(params = {}, lang = config.language) {
|
|
2123
|
+
const path = resolvePath(dataPaths.game, { lang });
|
|
2124
|
+
return edgeStatsClient.get(path, params);
|
|
2125
|
+
}
|
|
2126
|
+
async function getShiftChart(gameId, lang = config.language) {
|
|
2127
|
+
const path = resolvePath(dataPaths.shiftCharts, { lang });
|
|
2128
|
+
const cayenneExp = `gameId=${gameId}`;
|
|
2129
|
+
return edgeStatsClient.get(path, {
|
|
2130
|
+
cayenneExp
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
async function getDraft(lang = config.language) {
|
|
2134
|
+
const path = resolvePath(dataPaths.draft, { lang });
|
|
2135
|
+
return edgeStatsClient.get(path);
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// src/api/edge-stats/skaters.ts
|
|
2139
|
+
var skaters_exports2 = {};
|
|
2140
|
+
__export(skaters_exports2, {
|
|
2141
|
+
getLeaders: () => getLeaders2,
|
|
2142
|
+
getMilestones: () => getMilestones2,
|
|
2143
|
+
getPlayerInfo: () => getPlayerInfo,
|
|
2144
|
+
getStats: () => getStats2,
|
|
2145
|
+
getStatsWithBuilder: () => getStatsWithBuilder2,
|
|
2146
|
+
getStatsWithFilters: () => getStatsWithFilters2,
|
|
2147
|
+
getStatsWithParams: () => getStatsWithParams2
|
|
2148
|
+
});
|
|
2149
|
+
async function getPlayerInfo(params = {}, lang = config.language) {
|
|
2150
|
+
const path = resolvePath(dataPaths.skater.players, { lang });
|
|
2151
|
+
return edgeStatsClient.get(path, params);
|
|
2152
|
+
}
|
|
2153
|
+
async function getLeaders2(statCategory, params = {}, lang = config.language) {
|
|
2154
|
+
const path = resolvePath(dataPaths.skater.leaders[statCategory], { lang });
|
|
2155
|
+
return edgeStatsClient.get(path, params);
|
|
2156
|
+
}
|
|
2157
|
+
async function getMilestones2(lang = config.language) {
|
|
2158
|
+
const path = resolvePath(dataPaths.skater.milestones, { lang });
|
|
2159
|
+
return edgeStatsClient.get(path);
|
|
2160
|
+
}
|
|
2161
|
+
async function getStats2(report = "summary", params = {}, lang = config.language) {
|
|
2162
|
+
const path = resolvePath(dataPaths.skater.report, { lang, report });
|
|
2163
|
+
return edgeStatsClient.get(
|
|
2164
|
+
path,
|
|
2165
|
+
reportParams(params)
|
|
2166
|
+
);
|
|
2167
|
+
}
|
|
2168
|
+
async function getStatsWithParams2(report, params, lang = config.language) {
|
|
2169
|
+
return getStats2(report, params, lang);
|
|
2170
|
+
}
|
|
2171
|
+
async function getStatsWithBuilder2(report, buildQuery, lang = config.language) {
|
|
2172
|
+
return getStats2(report, buildQuery(new CayenneQueryBuilder()), lang);
|
|
2173
|
+
}
|
|
2174
|
+
async function getStatsWithFilters2(report, filters, sorting, pagination, lang = config.language) {
|
|
2175
|
+
return getStats2(
|
|
2176
|
+
report,
|
|
2177
|
+
filterParams(filters, sorting, pagination),
|
|
2178
|
+
lang
|
|
2179
|
+
);
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
// src/api/edge-stats/teams.ts
|
|
2183
|
+
var teams_exports2 = {};
|
|
2184
|
+
__export(teams_exports2, {
|
|
2185
|
+
getAll: () => getAll,
|
|
2186
|
+
getById: () => getById,
|
|
2187
|
+
getStats: () => getStats3,
|
|
2188
|
+
getStatsWithBuilder: () => getStatsWithBuilder3,
|
|
2189
|
+
getStatsWithFilters: () => getStatsWithFilters3,
|
|
2190
|
+
getStatsWithParams: () => getStatsWithParams3
|
|
2191
|
+
});
|
|
2192
|
+
async function getAll(params = {}, lang = config.language) {
|
|
2193
|
+
const path = resolvePath(dataPaths.team.all, { lang });
|
|
2194
|
+
return edgeStatsClient.get(path, params);
|
|
2195
|
+
}
|
|
2196
|
+
async function getById(teamId, params = {}, lang = config.language) {
|
|
2197
|
+
const path = resolvePath(dataPaths.team.byId, { lang, teamId });
|
|
2198
|
+
return edgeStatsClient.get(path, params);
|
|
2199
|
+
}
|
|
2200
|
+
async function getStats3(report = "summary", params = {}, lang = config.language) {
|
|
2201
|
+
const path = resolvePath(dataPaths.team.report, { lang, report });
|
|
2202
|
+
return edgeStatsClient.get(
|
|
2203
|
+
path,
|
|
2204
|
+
reportParams(params)
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
async function getStatsWithParams3(report, params, lang = config.language) {
|
|
2208
|
+
return getStats3(report, params, lang);
|
|
2209
|
+
}
|
|
2210
|
+
async function getStatsWithBuilder3(report, buildQuery, lang = config.language) {
|
|
2211
|
+
return getStats3(report, buildQuery(new CayenneQueryBuilder()), lang);
|
|
2212
|
+
}
|
|
2213
|
+
async function getStatsWithFilters3(report, filters, sorting, pagination, lang = config.language) {
|
|
2214
|
+
return getStats3(
|
|
2215
|
+
report,
|
|
2216
|
+
filterParams(filters, sorting, pagination),
|
|
2217
|
+
lang
|
|
2218
|
+
);
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
// src/api/gamecenter/index.ts
|
|
2222
|
+
var gamecenter_exports = {};
|
|
2223
|
+
__export(gamecenter_exports, {
|
|
2224
|
+
draft: () => draft_exports,
|
|
2225
|
+
game: () => game_exports,
|
|
2226
|
+
misc: () => misc_exports2,
|
|
2227
|
+
player: () => player_exports,
|
|
2228
|
+
score: () => score,
|
|
2229
|
+
scoreboard: () => scoreboard,
|
|
2230
|
+
team: () => team_exports
|
|
2231
|
+
});
|
|
2232
|
+
|
|
2233
|
+
// src/api/gamecenter/draft.ts
|
|
2234
|
+
var draft_exports = {};
|
|
2235
|
+
__export(draft_exports, {
|
|
2236
|
+
picks: () => picks,
|
|
2237
|
+
rankings: () => rankings,
|
|
2238
|
+
tracker: () => tracker
|
|
2239
|
+
});
|
|
2240
|
+
|
|
2241
|
+
// src/api/gamecenter/paths.ts
|
|
2242
|
+
var teamPaths = {
|
|
2243
|
+
/** Team roster seasons. */
|
|
1158
2244
|
rosterSeasons: "roster-season/{team}",
|
|
2245
|
+
/** Team roster for a specific season. */
|
|
1159
2246
|
roster: "roster/{team}/{season}",
|
|
2247
|
+
/** Team prospects. */
|
|
1160
2248
|
prospects: "prospects/{team}",
|
|
2249
|
+
/** Team club statistics for a specific season and game type. */
|
|
1161
2250
|
clubStats: "club-stats/{team}/{season}/{gameType}",
|
|
2251
|
+
/** Team club statistics summary for a season. */
|
|
1162
2252
|
clubStatsSeason: "club-stats-season/{team}",
|
|
2253
|
+
/** League standings for a specific date. */
|
|
1163
2254
|
standings: "standings/{date}",
|
|
2255
|
+
/** League standings summary for a season. */
|
|
1164
2256
|
standingsSeason: "standings-season",
|
|
2257
|
+
/** Team schedule data. */
|
|
1165
2258
|
clubSchedule: {
|
|
2259
|
+
/** Team schedule for a season. */
|
|
1166
2260
|
season: "club-schedule-season/{team}/{season}",
|
|
2261
|
+
/** Team schedule for a specific month. */
|
|
1167
2262
|
month: "club-schedule/{team}/month/{month}",
|
|
2263
|
+
/** Team schedule for a specific week. */
|
|
1168
2264
|
week: "club-schedule/{team}/week/{date}"
|
|
1169
2265
|
}
|
|
1170
2266
|
};
|
|
1171
|
-
var
|
|
2267
|
+
var scorePaths = {
|
|
2268
|
+
/** Game scores for a specific date. */
|
|
1172
2269
|
score: "score/{date}",
|
|
2270
|
+
/** Scoreboard data. */
|
|
1173
2271
|
scoreboard: {
|
|
2272
|
+
/** Current scoreboard. */
|
|
1174
2273
|
now: "scoreboard/now",
|
|
2274
|
+
/** Scoreboard for a specific team. */
|
|
1175
2275
|
byTeam: "scoreboard/{team}/now",
|
|
2276
|
+
/** Scoreboard for a specific date. */
|
|
1176
2277
|
byDate: "scoreboard/{date}"
|
|
1177
2278
|
}
|
|
1178
2279
|
};
|
|
1179
|
-
var
|
|
2280
|
+
var playerPaths = {
|
|
2281
|
+
/** Player landing page data. */
|
|
1180
2282
|
landing: "player/{playerId}/landing",
|
|
2283
|
+
/** Player game log for a season and game type. */
|
|
1181
2284
|
gameLog: "player/{playerId}/game-log/{season}/{gameType}",
|
|
2285
|
+
/** Current player spotlight. */
|
|
1182
2286
|
spotlight: "player-spotlight",
|
|
2287
|
+
/** Player statistics leaders. */
|
|
1183
2288
|
statsLeaders: {
|
|
2289
|
+
/** Skater statistics leaders. */
|
|
1184
2290
|
skaters: "skater-stats-leaders/{season}/{gameType}",
|
|
2291
|
+
/** Goalie statistics leaders. */
|
|
1185
2292
|
goalies: "goalie-stats-leaders/{season}/{gameType}"
|
|
1186
2293
|
},
|
|
2294
|
+
/** Player search functionality. */
|
|
1187
2295
|
playerSearch: "https://search.d3.nhle.com/api/v1/search/player"
|
|
1188
2296
|
};
|
|
1189
|
-
var
|
|
2297
|
+
var miscPaths = {
|
|
2298
|
+
/** Current season information. */
|
|
1190
2299
|
season: "season",
|
|
2300
|
+
/** Playoff series metadata for a specific year and series. */
|
|
1191
2301
|
metaPlayoffSeries: "meta/playoff-series/{year}/{seriesLetter}",
|
|
2302
|
+
/** Game metadata. */
|
|
1192
2303
|
metaGame: "meta/game/{gameId}",
|
|
2304
|
+
/** Location lookup by postal code. */
|
|
1193
2305
|
postalLookup: "postal-lookup/{postalCode}",
|
|
2306
|
+
/** Location information. */
|
|
1194
2307
|
location: "location",
|
|
2308
|
+
/** Partner game for a specific country. */
|
|
1195
2309
|
partnerGame: "partner-game/{countryCode}/now"
|
|
1196
2310
|
};
|
|
1197
|
-
var
|
|
2311
|
+
var gamePaths = {
|
|
2312
|
+
/** Game schedule for a specific date. */
|
|
1198
2313
|
schedule: "schedule/{date}",
|
|
2314
|
+
/** Game schedule calendar for a specific date. */
|
|
1199
2315
|
scheduleCalendar: "schedule-calendar/{date}",
|
|
2316
|
+
/** Playoff bracket for a specific year. */
|
|
1200
2317
|
playoffBracket: "playoff-bracket/{year}",
|
|
2318
|
+
/** Playoff series carousel for a season. */
|
|
1201
2319
|
playoffSeries: "playoff-series/carousel/{season}",
|
|
2320
|
+
/** Playoff series schedule. */
|
|
1202
2321
|
playoffSeriesSchedule: "schedule/playoff-series/{season}/{seriesLetter}",
|
|
2322
|
+
/** Game center data with multiple views. */
|
|
1203
2323
|
gamecenter: {
|
|
2324
|
+
/** Play-by-play data for a game. */
|
|
1204
2325
|
playByPlay: "gamecenter/{gameId}/play-by-play",
|
|
2326
|
+
/** Right rail reports for a game. */
|
|
1205
2327
|
reports: "gamecenter/{gameId}/right-rail",
|
|
2328
|
+
/** Game landing page. */
|
|
1206
2329
|
landing: "gamecenter/{gameId}/landing",
|
|
2330
|
+
/** Game box score. */
|
|
1207
2331
|
boxscore: "gamecenter/{gameId}/boxscore"
|
|
1208
2332
|
},
|
|
2333
|
+
/** Web Stat Center (WSC) data. */
|
|
1209
2334
|
wsc: {
|
|
2335
|
+
/** Game story from WSC. */
|
|
1210
2336
|
gameStory: "wsc/game-story/{gameId}",
|
|
2337
|
+
/** Play-by-play from WSC. */
|
|
1211
2338
|
playByPlay: "wsc/play-by-play/{gameId}"
|
|
1212
2339
|
},
|
|
2340
|
+
/** PPT replay data. */
|
|
1213
2341
|
pptReplay: {
|
|
2342
|
+
/** Goal replay. */
|
|
1214
2343
|
goal: "ppt-replay/goal/{gameId}/{eventId}",
|
|
2344
|
+
/** Event replay. */
|
|
1215
2345
|
event: "ppt-replay/{gameId}/{eventId}"
|
|
1216
2346
|
},
|
|
2347
|
+
/** Where to watch information. */
|
|
1217
2348
|
whereToWatch: "where-to-watch",
|
|
2349
|
+
/** Network TV schedule for a specific date. */
|
|
1218
2350
|
networkTVSchedule: "network/tv-schedule/{date}"
|
|
1219
2351
|
};
|
|
1220
|
-
var
|
|
2352
|
+
var draftPaths = {
|
|
2353
|
+
/** Draft picks data. */
|
|
1221
2354
|
draftPicks: {
|
|
2355
|
+
/** Draft picks by year and round. */
|
|
1222
2356
|
byYearAndRound: "draft/picks/{year}/{round}",
|
|
2357
|
+
/** All draft picks for a year. */
|
|
1223
2358
|
byYear: "draft/picks/{year}/all"
|
|
1224
2359
|
},
|
|
2360
|
+
/** Draft rankings for a year and type. */
|
|
1225
2361
|
draftRankings: "draft/rankings/{year}/{type}",
|
|
2362
|
+
/** Current draft tracker. */
|
|
1226
2363
|
draftTracker: "draft-tracker/picks/now"
|
|
1227
2364
|
};
|
|
1228
2365
|
|
|
@@ -1231,18 +2368,22 @@ async function picks(year, round) {
|
|
|
1231
2368
|
const parsed = DraftParams({ year, round });
|
|
1232
2369
|
if (isParseError(parsed)) {
|
|
1233
2370
|
return {
|
|
1234
|
-
|
|
2371
|
+
success: false,
|
|
1235
2372
|
error: new ValidationError(parsed.summary, {
|
|
1236
|
-
endpoint:
|
|
2373
|
+
endpoint: draftPaths.draftPicks.byYearAndRound
|
|
1237
2374
|
})
|
|
1238
2375
|
};
|
|
1239
2376
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
2377
|
+
let path = "";
|
|
2378
|
+
if (parsed.year && !parsed.round) {
|
|
2379
|
+
path = resolvePath(draftPaths.draftPicks.byYear, parsed);
|
|
2380
|
+
} else {
|
|
2381
|
+
path = resolvePath(draftPaths.draftPicks.byYearAndRound, parsed);
|
|
2382
|
+
}
|
|
2383
|
+
return nhlClient.get(path);
|
|
1243
2384
|
}
|
|
1244
2385
|
async function tracker() {
|
|
1245
|
-
return
|
|
2386
|
+
return nhlClient.get(draftPaths.draftTracker);
|
|
1246
2387
|
}
|
|
1247
2388
|
function rankings(year) {
|
|
1248
2389
|
const DraftRankingsEnum = {
|
|
@@ -1252,21 +2393,17 @@ function rankings(year) {
|
|
|
1252
2393
|
goaliesIntl: "4"
|
|
1253
2394
|
};
|
|
1254
2395
|
const getRankings = async (type2) => {
|
|
1255
|
-
const parsedYear = Year(year ??
|
|
2396
|
+
const parsedYear = Year(year ?? getCurrentNHLYear());
|
|
1256
2397
|
if (isParseError(parsedYear)) {
|
|
1257
2398
|
return {
|
|
1258
|
-
|
|
2399
|
+
success: false,
|
|
1259
2400
|
error: new ValidationError(parsedYear.summary, {
|
|
1260
|
-
endpoint:
|
|
2401
|
+
endpoint: draftPaths.draftRankings
|
|
1261
2402
|
})
|
|
1262
2403
|
};
|
|
1263
2404
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
year: parsedYear,
|
|
1267
|
-
type: type2
|
|
1268
|
-
})
|
|
1269
|
-
);
|
|
2405
|
+
const path = resolvePath(draftPaths.draftRankings, { year: parsedYear, type: type2 });
|
|
2406
|
+
return nhlClient.get(path);
|
|
1270
2407
|
};
|
|
1271
2408
|
return {
|
|
1272
2409
|
/**
|
|
@@ -1295,7 +2432,7 @@ function rankings(year) {
|
|
|
1295
2432
|
*/
|
|
1296
2433
|
all: async () => {
|
|
1297
2434
|
const unwrapAPIResponse = (apiResponse) => {
|
|
1298
|
-
if (apiResponse.
|
|
2435
|
+
if (apiResponse.success) {
|
|
1299
2436
|
return apiResponse.data;
|
|
1300
2437
|
}
|
|
1301
2438
|
throw apiResponse.error;
|
|
@@ -1309,13 +2446,13 @@ function rankings(year) {
|
|
|
1309
2446
|
try {
|
|
1310
2447
|
const dataOnly = response.map((r) => unwrapAPIResponse(r));
|
|
1311
2448
|
const newResponse = {
|
|
1312
|
-
|
|
2449
|
+
success: true,
|
|
1313
2450
|
data: dataOnly
|
|
1314
2451
|
};
|
|
1315
2452
|
return newResponse;
|
|
1316
2453
|
} catch (error) {
|
|
1317
2454
|
return {
|
|
1318
|
-
|
|
2455
|
+
success: false,
|
|
1319
2456
|
error
|
|
1320
2457
|
};
|
|
1321
2458
|
}
|
|
@@ -1344,57 +2481,57 @@ async function playByPlay(gameId) {
|
|
|
1344
2481
|
const parsedGameId = GameId(gameId);
|
|
1345
2482
|
if (isParseError(parsedGameId)) {
|
|
1346
2483
|
return {
|
|
1347
|
-
|
|
2484
|
+
success: false,
|
|
1348
2485
|
error: new ValidationError(parsedGameId.summary, {
|
|
1349
|
-
endpoint:
|
|
2486
|
+
endpoint: gamePaths.gamecenter.playByPlay
|
|
1350
2487
|
})
|
|
1351
2488
|
};
|
|
1352
2489
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
);
|
|
2490
|
+
const path = resolvePath(gamePaths.gamecenter.playByPlay, {
|
|
2491
|
+
gameId: parsedGameId
|
|
2492
|
+
});
|
|
2493
|
+
return nhlClient.get(path);
|
|
1356
2494
|
}
|
|
1357
2495
|
async function reports(gameId) {
|
|
1358
2496
|
const parsedGameId = GameId(gameId);
|
|
1359
2497
|
if (isParseError(parsedGameId)) {
|
|
1360
2498
|
return {
|
|
1361
|
-
|
|
2499
|
+
success: false,
|
|
1362
2500
|
error: new ValidationError(parsedGameId.summary, {
|
|
1363
|
-
endpoint:
|
|
2501
|
+
endpoint: gamePaths.gamecenter.reports
|
|
1364
2502
|
})
|
|
1365
2503
|
};
|
|
1366
2504
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
);
|
|
2505
|
+
const path = resolvePath(gamePaths.gamecenter.reports, { gameId: parsedGameId });
|
|
2506
|
+
return nhlClient.get(path);
|
|
1370
2507
|
}
|
|
1371
2508
|
async function landing(gameId) {
|
|
1372
2509
|
const parsedGameId = GameId(gameId);
|
|
1373
2510
|
if (isParseError(parsedGameId)) {
|
|
1374
2511
|
return {
|
|
1375
|
-
|
|
2512
|
+
success: false,
|
|
1376
2513
|
error: new ValidationError(parsedGameId.summary, {
|
|
1377
|
-
endpoint:
|
|
2514
|
+
endpoint: gamePaths.gamecenter.landing
|
|
1378
2515
|
})
|
|
1379
2516
|
};
|
|
1380
2517
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
);
|
|
2518
|
+
const path = resolvePath(gamePaths.gamecenter.landing, { gameId: parsedGameId });
|
|
2519
|
+
return nhlClient.get(path);
|
|
1384
2520
|
}
|
|
1385
2521
|
async function boxscore(gameId) {
|
|
1386
2522
|
const parsedGameId = GameId(gameId);
|
|
1387
2523
|
if (isParseError(parsedGameId)) {
|
|
1388
2524
|
return {
|
|
1389
|
-
|
|
2525
|
+
success: false,
|
|
1390
2526
|
error: new ValidationError(parsedGameId.summary, {
|
|
1391
|
-
endpoint:
|
|
2527
|
+
endpoint: gamePaths.gamecenter.boxscore
|
|
1392
2528
|
})
|
|
1393
2529
|
};
|
|
1394
2530
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
);
|
|
2531
|
+
const path = resolvePath(gamePaths.gamecenter.boxscore, {
|
|
2532
|
+
gameId: parsedGameId
|
|
2533
|
+
});
|
|
2534
|
+
return nhlClient.get(path);
|
|
1398
2535
|
}
|
|
1399
2536
|
var wsc = {
|
|
1400
2537
|
gameStory: wscGameStory,
|
|
@@ -1404,29 +2541,27 @@ async function wscGameStory(gameId) {
|
|
|
1404
2541
|
const parsedGameId = GameId(gameId);
|
|
1405
2542
|
if (isParseError(parsedGameId)) {
|
|
1406
2543
|
return {
|
|
1407
|
-
|
|
2544
|
+
success: false,
|
|
1408
2545
|
error: new ValidationError(parsedGameId.summary, {
|
|
1409
|
-
endpoint:
|
|
2546
|
+
endpoint: gamePaths.wsc.gameStory
|
|
1410
2547
|
})
|
|
1411
2548
|
};
|
|
1412
2549
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
);
|
|
2550
|
+
const path = resolvePath(gamePaths.wsc.gameStory, { gameId: parsedGameId });
|
|
2551
|
+
return nhlClient.get(path);
|
|
1416
2552
|
}
|
|
1417
2553
|
async function wscPlayByPlay(gameId) {
|
|
1418
2554
|
const parsedGameId = GameId(gameId);
|
|
1419
2555
|
if (isParseError(parsedGameId)) {
|
|
1420
2556
|
return {
|
|
1421
|
-
|
|
2557
|
+
success: false,
|
|
1422
2558
|
error: new ValidationError(parsedGameId.summary, {
|
|
1423
|
-
endpoint:
|
|
2559
|
+
endpoint: gamePaths.wsc.playByPlay
|
|
1424
2560
|
})
|
|
1425
2561
|
};
|
|
1426
2562
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
);
|
|
2563
|
+
const path = resolvePath(gamePaths.wsc.playByPlay, { gameId: parsedGameId });
|
|
2564
|
+
return nhlClient.get(path);
|
|
1430
2565
|
}
|
|
1431
2566
|
var pptReplay = {
|
|
1432
2567
|
goal: pptReplayGoal,
|
|
@@ -1436,77 +2571,79 @@ async function pptReplayGoal(gameId, eventId) {
|
|
|
1436
2571
|
const parsed = GameIdAndEventId({ gameId, eventId });
|
|
1437
2572
|
if (isParseError(parsed)) {
|
|
1438
2573
|
return {
|
|
1439
|
-
|
|
2574
|
+
success: false,
|
|
1440
2575
|
error: new ValidationError(parsed.summary, {
|
|
1441
|
-
endpoint:
|
|
2576
|
+
endpoint: gamePaths.pptReplay.goal
|
|
1442
2577
|
})
|
|
1443
2578
|
};
|
|
1444
2579
|
}
|
|
1445
|
-
|
|
2580
|
+
const path = resolvePath(gamePaths.pptReplay.goal, { gameId, eventId });
|
|
2581
|
+
return nhlClient.get(path);
|
|
1446
2582
|
}
|
|
1447
2583
|
async function pptReplayEvent(gameId, eventId) {
|
|
1448
2584
|
const parsed = GameIdAndEventId({ gameId, eventId });
|
|
1449
2585
|
if (isParseError(parsed)) {
|
|
1450
2586
|
return {
|
|
1451
|
-
|
|
2587
|
+
success: false,
|
|
1452
2588
|
error: new ValidationError(parsed.summary, {
|
|
1453
|
-
endpoint:
|
|
2589
|
+
endpoint: gamePaths.pptReplay.event
|
|
1454
2590
|
})
|
|
1455
2591
|
};
|
|
1456
2592
|
}
|
|
1457
|
-
|
|
2593
|
+
const path = resolvePath(gamePaths.pptReplay.event, { gameId, eventId });
|
|
2594
|
+
return nhlClient.get(path);
|
|
1458
2595
|
}
|
|
1459
2596
|
async function schedule(date) {
|
|
1460
|
-
const parsedDate = NHLDate(date ??
|
|
2597
|
+
const parsedDate = NHLDate(date ?? getCurrentNHLDate());
|
|
1461
2598
|
if (isParseError(parsedDate)) {
|
|
1462
2599
|
return {
|
|
1463
|
-
|
|
2600
|
+
success: false,
|
|
1464
2601
|
error: new ValidationError(parsedDate.summary, {
|
|
1465
|
-
endpoint:
|
|
2602
|
+
endpoint: gamePaths.schedule
|
|
1466
2603
|
})
|
|
1467
2604
|
};
|
|
1468
2605
|
}
|
|
1469
|
-
|
|
2606
|
+
const path = resolvePath(gamePaths.schedule, { date: parsedDate });
|
|
2607
|
+
return nhlClient.get(path);
|
|
1470
2608
|
}
|
|
1471
2609
|
async function scheduleCalendar(date) {
|
|
1472
2610
|
const parsedDate = NHLDate(date);
|
|
1473
2611
|
if (isParseError(parsedDate)) {
|
|
1474
2612
|
return {
|
|
1475
|
-
|
|
2613
|
+
success: false,
|
|
1476
2614
|
error: new ValidationError(parsedDate.summary, {
|
|
1477
|
-
endpoint:
|
|
2615
|
+
endpoint: gamePaths.scheduleCalendar
|
|
1478
2616
|
})
|
|
1479
2617
|
};
|
|
1480
2618
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
);
|
|
2619
|
+
const path = resolvePath(gamePaths.scheduleCalendar, { date: parsedDate });
|
|
2620
|
+
return nhlClient.get(path);
|
|
1484
2621
|
}
|
|
1485
2622
|
async function playoffBracket(year) {
|
|
1486
|
-
const parsedYear = Year(year ??
|
|
2623
|
+
const parsedYear = Year(year ?? getCurrentNHLYear());
|
|
1487
2624
|
if (isParseError(parsedYear)) {
|
|
1488
2625
|
return {
|
|
1489
|
-
|
|
2626
|
+
success: false,
|
|
1490
2627
|
error: new ValidationError(parsedYear.summary, {
|
|
1491
|
-
endpoint:
|
|
2628
|
+
endpoint: gamePaths.playoffBracket
|
|
1492
2629
|
})
|
|
1493
2630
|
};
|
|
1494
2631
|
}
|
|
1495
|
-
|
|
2632
|
+
const path = resolvePath(gamePaths.playoffBracket, { year: parsedYear });
|
|
2633
|
+
return nhlClient.get(path);
|
|
1496
2634
|
}
|
|
1497
2635
|
async function playoffSeries(season) {
|
|
1498
2636
|
const parsedSeason = Season(season ?? getCurrentSeason());
|
|
1499
2637
|
if (isParseError(parsedSeason)) {
|
|
1500
2638
|
return {
|
|
1501
|
-
|
|
2639
|
+
success: false,
|
|
1502
2640
|
error: new ValidationError(parsedSeason.summary, {
|
|
1503
|
-
endpoint:
|
|
2641
|
+
endpoint: gamePaths.playoffSeries
|
|
1504
2642
|
})
|
|
1505
2643
|
};
|
|
1506
2644
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
);
|
|
2645
|
+
const path = resolvePath(gamePaths.playoffSeries, { season: parsedSeason });
|
|
2646
|
+
return nhlClient.get(path);
|
|
1510
2647
|
}
|
|
1511
2648
|
async function playoffSeriesSchedule(seriesLetter, season) {
|
|
1512
2649
|
const parsed = SeriesAndSeasonParams({
|
|
@@ -1515,35 +2652,36 @@ async function playoffSeriesSchedule(seriesLetter, season) {
|
|
|
1515
2652
|
});
|
|
1516
2653
|
if (isParseError(parsed)) {
|
|
1517
2654
|
return {
|
|
1518
|
-
|
|
2655
|
+
success: false,
|
|
1519
2656
|
error: new ValidationError(parsed.summary, {
|
|
1520
|
-
endpoint:
|
|
2657
|
+
endpoint: gamePaths.playoffSeriesSchedule
|
|
1521
2658
|
})
|
|
1522
2659
|
};
|
|
1523
2660
|
}
|
|
1524
|
-
|
|
2661
|
+
const path = resolvePath(gamePaths.playoffSeriesSchedule, parsed);
|
|
2662
|
+
return nhlClient.get(path);
|
|
1525
2663
|
}
|
|
1526
2664
|
async function whereToWatch() {
|
|
1527
|
-
|
|
2665
|
+
const path = resolvePath(gamePaths.whereToWatch, {});
|
|
2666
|
+
return nhlClient.get(path);
|
|
1528
2667
|
}
|
|
1529
2668
|
async function networkTVSchedule(date) {
|
|
1530
|
-
const parsedDate = NHLDate(date ??
|
|
2669
|
+
const parsedDate = NHLDate(date ?? getCurrentNHLDate());
|
|
1531
2670
|
if (isParseError(parsedDate)) {
|
|
1532
2671
|
return {
|
|
1533
|
-
|
|
2672
|
+
success: false,
|
|
1534
2673
|
error: new ValidationError(parsedDate.summary, {
|
|
1535
|
-
endpoint:
|
|
2674
|
+
endpoint: gamePaths.networkTVSchedule
|
|
1536
2675
|
})
|
|
1537
2676
|
};
|
|
1538
2677
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
);
|
|
2678
|
+
const path = resolvePath(gamePaths.networkTVSchedule, { date: parsedDate });
|
|
2679
|
+
return nhlClient.get(path);
|
|
1542
2680
|
}
|
|
1543
2681
|
|
|
1544
2682
|
// src/api/gamecenter/misc.ts
|
|
1545
|
-
var
|
|
1546
|
-
__export(
|
|
2683
|
+
var misc_exports2 = {};
|
|
2684
|
+
__export(misc_exports2, {
|
|
1547
2685
|
location: () => location,
|
|
1548
2686
|
meta: () => meta,
|
|
1549
2687
|
partnerGame: () => partnerGame,
|
|
@@ -1551,7 +2689,7 @@ __export(misc_exports, {
|
|
|
1551
2689
|
seasons: () => seasons
|
|
1552
2690
|
});
|
|
1553
2691
|
async function seasons() {
|
|
1554
|
-
return
|
|
2692
|
+
return nhlClient.get(miscPaths.season);
|
|
1555
2693
|
}
|
|
1556
2694
|
var meta = {
|
|
1557
2695
|
game: metaGame,
|
|
@@ -1561,56 +2699,60 @@ async function metaGame(gameId) {
|
|
|
1561
2699
|
const parsedGameId = GameId(gameId);
|
|
1562
2700
|
if (isParseError(parsedGameId)) {
|
|
1563
2701
|
return {
|
|
1564
|
-
|
|
2702
|
+
success: false,
|
|
1565
2703
|
error: new ValidationError(parsedGameId.summary, {
|
|
1566
|
-
endpoint:
|
|
2704
|
+
endpoint: miscPaths.metaGame
|
|
1567
2705
|
})
|
|
1568
2706
|
};
|
|
1569
2707
|
}
|
|
1570
|
-
|
|
2708
|
+
const path = resolvePath(miscPaths.metaGame, { gameId: parsedGameId });
|
|
2709
|
+
return nhlClient.get(path);
|
|
1571
2710
|
}
|
|
1572
2711
|
async function metaPlayoffSeries(seriesLetter, year) {
|
|
1573
2712
|
const parsed = SeriesParams({ year, seriesLetter });
|
|
1574
2713
|
if (isParseError(parsed)) {
|
|
1575
2714
|
return {
|
|
1576
|
-
|
|
2715
|
+
success: false,
|
|
1577
2716
|
error: new ValidationError(parsed.summary, {
|
|
1578
|
-
endpoint:
|
|
2717
|
+
endpoint: miscPaths.metaPlayoffSeries
|
|
1579
2718
|
})
|
|
1580
2719
|
};
|
|
1581
2720
|
}
|
|
1582
|
-
|
|
2721
|
+
const path = resolvePath(miscPaths.metaPlayoffSeries, parsed);
|
|
2722
|
+
return nhlClient.get(path);
|
|
1583
2723
|
}
|
|
1584
2724
|
async function postalLookup(postalCode) {
|
|
1585
2725
|
const parsedPostalCode = PostalCode(postalCode);
|
|
1586
2726
|
if (isParseError(parsedPostalCode)) {
|
|
1587
2727
|
return {
|
|
1588
|
-
|
|
2728
|
+
success: false,
|
|
1589
2729
|
error: new ValidationError(parsedPostalCode.summary, {
|
|
1590
|
-
endpoint:
|
|
2730
|
+
endpoint: miscPaths.postalLookup
|
|
1591
2731
|
})
|
|
1592
2732
|
};
|
|
1593
2733
|
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
);
|
|
2734
|
+
const path = resolvePath(miscPaths.postalLookup, {
|
|
2735
|
+
postalCode: parsedPostalCode
|
|
2736
|
+
});
|
|
2737
|
+
return nhlClient.get(path);
|
|
1597
2738
|
}
|
|
1598
2739
|
async function location() {
|
|
1599
|
-
return
|
|
2740
|
+
return nhlClient.get(miscPaths.location);
|
|
1600
2741
|
}
|
|
1601
2742
|
async function partnerGame(countryCode) {
|
|
1602
2743
|
const parsedCountryCode = CountryCode(countryCode);
|
|
1603
2744
|
if (isParseError(parsedCountryCode)) {
|
|
1604
2745
|
return {
|
|
1605
|
-
|
|
2746
|
+
success: false,
|
|
1606
2747
|
error: new ValidationError(parsedCountryCode.summary, {
|
|
1607
|
-
endpoint:
|
|
2748
|
+
endpoint: miscPaths.partnerGame
|
|
1608
2749
|
})
|
|
1609
2750
|
};
|
|
1610
2751
|
}
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
);
|
|
2752
|
+
const path = resolvePath(miscPaths.partnerGame, {
|
|
2753
|
+
countryCode: parsedCountryCode
|
|
2754
|
+
});
|
|
2755
|
+
return nhlClient.get(path);
|
|
1614
2756
|
}
|
|
1615
2757
|
|
|
1616
2758
|
// src/api/gamecenter/player.ts
|
|
@@ -1622,21 +2764,20 @@ __export(player_exports, {
|
|
|
1622
2764
|
spotlight: () => spotlight,
|
|
1623
2765
|
statsLeaders: () => statsLeaders
|
|
1624
2766
|
});
|
|
1625
|
-
var nhlPlayerSearch = createNHLClient(
|
|
2767
|
+
var nhlPlayerSearch = createNHLClient(playerPaths.playerSearch);
|
|
1626
2768
|
var searchUrlParams = { culture: "en", q: "" };
|
|
1627
2769
|
async function landing2(playerId) {
|
|
1628
2770
|
const parsedPlayerId = PlayerId(playerId);
|
|
1629
2771
|
if (isParseError(parsedPlayerId)) {
|
|
1630
2772
|
return {
|
|
1631
|
-
|
|
2773
|
+
success: false,
|
|
1632
2774
|
error: new ValidationError(parsedPlayerId.summary, {
|
|
1633
|
-
endpoint:
|
|
2775
|
+
endpoint: playerPaths.landing
|
|
1634
2776
|
})
|
|
1635
2777
|
};
|
|
1636
2778
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
);
|
|
2779
|
+
const path = resolvePath(playerPaths.landing, { playerId: parsedPlayerId });
|
|
2780
|
+
return nhlClient.get(path);
|
|
1640
2781
|
}
|
|
1641
2782
|
async function gameLog(playerId, season, gameType) {
|
|
1642
2783
|
const Parser = BaseParams.merge({
|
|
@@ -1645,16 +2786,17 @@ async function gameLog(playerId, season, gameType) {
|
|
|
1645
2786
|
const parsed = Parser({ playerId, season, gameType });
|
|
1646
2787
|
if (isParseError(parsed)) {
|
|
1647
2788
|
return {
|
|
1648
|
-
|
|
2789
|
+
success: false,
|
|
1649
2790
|
error: new ValidationError(parsed.summary, {
|
|
1650
|
-
endpoint:
|
|
2791
|
+
endpoint: playerPaths.gameLog
|
|
1651
2792
|
})
|
|
1652
2793
|
};
|
|
1653
2794
|
}
|
|
1654
|
-
|
|
2795
|
+
const path = resolvePath(playerPaths.gameLog, parsed);
|
|
2796
|
+
return nhlClient.get(path);
|
|
1655
2797
|
}
|
|
1656
2798
|
async function spotlight() {
|
|
1657
|
-
return
|
|
2799
|
+
return nhlClient.get(playerPaths.spotlight);
|
|
1658
2800
|
}
|
|
1659
2801
|
async function search(query) {
|
|
1660
2802
|
return nhlPlayerSearch.get("", {
|
|
@@ -1670,70 +2812,71 @@ async function statsLeadersSkaters(season, gameType) {
|
|
|
1670
2812
|
const parsed = BaseParams({ season, gameType });
|
|
1671
2813
|
if (isParseError(parsed)) {
|
|
1672
2814
|
return {
|
|
1673
|
-
|
|
2815
|
+
success: false,
|
|
1674
2816
|
error: new ValidationError(parsed.summary, {
|
|
1675
|
-
endpoint:
|
|
2817
|
+
endpoint: playerPaths.statsLeaders.skaters
|
|
1676
2818
|
})
|
|
1677
2819
|
};
|
|
1678
2820
|
}
|
|
1679
|
-
|
|
2821
|
+
const path = resolvePath(playerPaths.statsLeaders.skaters, parsed);
|
|
2822
|
+
return nhlClient.get(path);
|
|
1680
2823
|
}
|
|
1681
2824
|
async function statsLeadersGoalies(season, gameType) {
|
|
1682
2825
|
const parsed = BaseParams({ season, gameType });
|
|
1683
2826
|
if (isParseError(parsed)) {
|
|
1684
2827
|
return {
|
|
1685
|
-
|
|
2828
|
+
success: false,
|
|
1686
2829
|
error: new ValidationError(parsed.summary, {
|
|
1687
|
-
endpoint:
|
|
2830
|
+
endpoint: playerPaths.statsLeaders.goalies
|
|
1688
2831
|
})
|
|
1689
2832
|
};
|
|
1690
2833
|
}
|
|
1691
|
-
|
|
2834
|
+
const path = resolvePath(playerPaths.statsLeaders.goalies, parsed);
|
|
2835
|
+
return nhlClient.get(path);
|
|
1692
2836
|
}
|
|
1693
2837
|
|
|
1694
2838
|
// src/api/gamecenter/score.ts
|
|
1695
2839
|
async function score(date) {
|
|
1696
|
-
const parsed = NHLDate(date ??
|
|
2840
|
+
const parsed = NHLDate(date ?? getCurrentNHLDate());
|
|
1697
2841
|
if (isParseError(parsed)) {
|
|
1698
2842
|
return {
|
|
1699
|
-
|
|
2843
|
+
success: false,
|
|
1700
2844
|
error: new ValidationError(parsed.summary, {
|
|
1701
|
-
endpoint:
|
|
2845
|
+
endpoint: scorePaths.score
|
|
1702
2846
|
})
|
|
1703
2847
|
};
|
|
1704
2848
|
}
|
|
1705
|
-
|
|
2849
|
+
const path = resolvePath(scorePaths.score, { date: parsed });
|
|
2850
|
+
return nhlClient.get(path);
|
|
1706
2851
|
}
|
|
1707
2852
|
async function scoreboard() {
|
|
1708
|
-
return
|
|
2853
|
+
return nhlClient.get(scorePaths.scoreboard.now);
|
|
1709
2854
|
}
|
|
1710
2855
|
scoreboard.team = async (team) => {
|
|
1711
2856
|
const parsed = TeamAbbrev(team);
|
|
1712
2857
|
if (isParseError(parsed)) {
|
|
1713
2858
|
return {
|
|
1714
|
-
|
|
2859
|
+
success: false,
|
|
1715
2860
|
error: new ValidationError(parsed.summary, {
|
|
1716
|
-
endpoint:
|
|
2861
|
+
endpoint: scorePaths.scoreboard.byTeam
|
|
1717
2862
|
})
|
|
1718
2863
|
};
|
|
1719
2864
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
);
|
|
2865
|
+
const path = resolvePath(scorePaths.scoreboard.byTeam, { team: parsed });
|
|
2866
|
+
return nhlClient.get(path);
|
|
1723
2867
|
};
|
|
1724
2868
|
scoreboard.date = async (date) => {
|
|
1725
2869
|
const parsed = NHLDate(date);
|
|
1726
2870
|
if (isParseError(parsed)) {
|
|
1727
2871
|
return {
|
|
1728
|
-
|
|
2872
|
+
success: false,
|
|
1729
2873
|
error: new ValidationError(parsed.summary, {
|
|
1730
|
-
endpoint:
|
|
2874
|
+
endpoint: scorePaths.scoreboard.byDate
|
|
1731
2875
|
})
|
|
1732
2876
|
};
|
|
1733
2877
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
);
|
|
2878
|
+
const path = resolvePath(scorePaths.scoreboard.byDate, { date: parsed });
|
|
2879
|
+
return nhlClient.get(path);
|
|
1737
2880
|
};
|
|
1738
2881
|
|
|
1739
2882
|
// src/api/gamecenter/team.ts
|
|
@@ -1745,122 +2888,131 @@ __export(team_exports, {
|
|
|
1745
2888
|
schedule: () => schedule2,
|
|
1746
2889
|
standings: () => standings,
|
|
1747
2890
|
standingsSeason: () => standingsSeason,
|
|
1748
|
-
stats: () =>
|
|
2891
|
+
stats: () => stats2,
|
|
1749
2892
|
statsSeason: () => statsSeason
|
|
1750
2893
|
});
|
|
1751
2894
|
async function rosterSeasons(team) {
|
|
1752
2895
|
const parsed = TeamAbbrev(team);
|
|
1753
2896
|
if (isParseError(parsed)) {
|
|
1754
2897
|
return {
|
|
1755
|
-
|
|
2898
|
+
success: false,
|
|
1756
2899
|
error: new ValidationError(parsed.summary, {
|
|
1757
|
-
endpoint:
|
|
2900
|
+
endpoint: teamPaths.rosterSeasons
|
|
1758
2901
|
})
|
|
1759
2902
|
};
|
|
1760
2903
|
}
|
|
1761
|
-
|
|
2904
|
+
const path = resolvePath(teamPaths.rosterSeasons, { team: parsed });
|
|
2905
|
+
return nhlClient.get(path);
|
|
1762
2906
|
}
|
|
1763
2907
|
async function roster(team, season) {
|
|
1764
2908
|
const parsed = TeamAndSeasonParams({ team, season });
|
|
1765
2909
|
if (isParseError(parsed)) {
|
|
1766
2910
|
return {
|
|
1767
|
-
|
|
2911
|
+
success: false,
|
|
1768
2912
|
error: new ValidationError(parsed.summary, {
|
|
1769
|
-
endpoint:
|
|
2913
|
+
endpoint: teamPaths.roster
|
|
1770
2914
|
})
|
|
1771
2915
|
};
|
|
1772
2916
|
}
|
|
1773
|
-
|
|
2917
|
+
const path = resolvePath(teamPaths.roster, parsed);
|
|
2918
|
+
return nhlClient.get(path);
|
|
1774
2919
|
}
|
|
1775
2920
|
async function prospects(team) {
|
|
1776
2921
|
const parsed = TeamAbbrev(team);
|
|
1777
2922
|
if (isParseError(parsed)) {
|
|
1778
2923
|
return {
|
|
1779
|
-
|
|
2924
|
+
success: false,
|
|
1780
2925
|
error: new ValidationError(parsed.summary, {
|
|
1781
|
-
endpoint:
|
|
2926
|
+
endpoint: teamPaths.prospects
|
|
1782
2927
|
})
|
|
1783
2928
|
};
|
|
1784
2929
|
}
|
|
1785
|
-
|
|
2930
|
+
const path = resolvePath(teamPaths.prospects, { team: parsed });
|
|
2931
|
+
return nhlClient.get(path);
|
|
1786
2932
|
}
|
|
1787
|
-
async function
|
|
2933
|
+
async function stats2(team, season, gameType) {
|
|
1788
2934
|
const Parser = BaseParams.merge({
|
|
1789
2935
|
team: TeamAbbrev
|
|
1790
2936
|
});
|
|
1791
2937
|
const parsed = Parser({ team, season, gameType });
|
|
1792
2938
|
if (isParseError(parsed)) {
|
|
1793
2939
|
return {
|
|
1794
|
-
|
|
2940
|
+
success: false,
|
|
1795
2941
|
error: new ValidationError(parsed.summary, {
|
|
1796
|
-
endpoint:
|
|
2942
|
+
endpoint: teamPaths.clubStats
|
|
1797
2943
|
})
|
|
1798
2944
|
};
|
|
1799
2945
|
}
|
|
1800
|
-
|
|
2946
|
+
const path = resolvePath(teamPaths.clubStats, parsed);
|
|
2947
|
+
return nhlClient.get(path);
|
|
1801
2948
|
}
|
|
1802
2949
|
async function statsSeason(team) {
|
|
1803
2950
|
const parsed = TeamAbbrev(team);
|
|
1804
2951
|
if (isParseError(parsed)) {
|
|
1805
2952
|
return {
|
|
1806
|
-
|
|
2953
|
+
success: false,
|
|
1807
2954
|
error: new ValidationError(parsed.summary, {
|
|
1808
|
-
endpoint:
|
|
2955
|
+
endpoint: teamPaths.clubStatsSeason
|
|
1809
2956
|
})
|
|
1810
2957
|
};
|
|
1811
2958
|
}
|
|
1812
|
-
|
|
2959
|
+
const path = resolvePath(teamPaths.clubStatsSeason, { team: parsed });
|
|
2960
|
+
return nhlClient.get(path);
|
|
1813
2961
|
}
|
|
1814
2962
|
async function standings(date) {
|
|
1815
|
-
const parsed = NHLDate(date ??
|
|
2963
|
+
const parsed = NHLDate(date ?? getCurrentNHLDate());
|
|
1816
2964
|
if (isParseError(parsed)) {
|
|
1817
2965
|
return {
|
|
1818
|
-
|
|
2966
|
+
success: false,
|
|
1819
2967
|
error: new ValidationError(parsed.summary, {
|
|
1820
|
-
endpoint:
|
|
2968
|
+
endpoint: teamPaths.standings
|
|
1821
2969
|
})
|
|
1822
2970
|
};
|
|
1823
2971
|
}
|
|
1824
|
-
|
|
2972
|
+
const path = resolvePath(teamPaths.standings, { date: parsed });
|
|
2973
|
+
return nhlClient.get(path);
|
|
1825
2974
|
}
|
|
1826
2975
|
async function standingsSeason() {
|
|
1827
|
-
return
|
|
2976
|
+
return nhlClient.get(teamPaths.standingsSeason);
|
|
1828
2977
|
}
|
|
1829
2978
|
async function scheduleWeek(team, date) {
|
|
1830
2979
|
const parsed = ScheduleParams({ team, date, month: void 0 });
|
|
1831
2980
|
if (isParseError(parsed)) {
|
|
1832
2981
|
return {
|
|
1833
|
-
|
|
2982
|
+
success: false,
|
|
1834
2983
|
error: new ValidationError(parsed.summary, {
|
|
1835
|
-
endpoint:
|
|
2984
|
+
endpoint: teamPaths.clubSchedule.week
|
|
1836
2985
|
})
|
|
1837
2986
|
};
|
|
1838
2987
|
}
|
|
1839
|
-
|
|
2988
|
+
const path = resolvePath(teamPaths.clubSchedule.week, parsed);
|
|
2989
|
+
return nhlClient.get(path);
|
|
1840
2990
|
}
|
|
1841
2991
|
async function scheduleMonth(team, date) {
|
|
1842
2992
|
const parsed = ScheduleParams({ team, month: date, date: void 0 });
|
|
1843
2993
|
if (isParseError(parsed)) {
|
|
1844
2994
|
return {
|
|
1845
|
-
|
|
2995
|
+
success: false,
|
|
1846
2996
|
error: new ValidationError(parsed.summary, {
|
|
1847
|
-
endpoint:
|
|
2997
|
+
endpoint: teamPaths.clubSchedule.month
|
|
1848
2998
|
})
|
|
1849
2999
|
};
|
|
1850
3000
|
}
|
|
1851
|
-
|
|
3001
|
+
const path = resolvePath(teamPaths.clubSchedule.month, parsed);
|
|
3002
|
+
return nhlClient.get(path);
|
|
1852
3003
|
}
|
|
1853
3004
|
async function scheduleSeason(team, season) {
|
|
1854
3005
|
const parsed = TeamAndSeasonParams({ team, season });
|
|
1855
3006
|
if (isParseError(parsed)) {
|
|
1856
3007
|
return {
|
|
1857
|
-
|
|
3008
|
+
success: false,
|
|
1858
3009
|
error: new ValidationError(parsed.summary, {
|
|
1859
|
-
endpoint:
|
|
3010
|
+
endpoint: teamPaths.clubSchedule.season
|
|
1860
3011
|
})
|
|
1861
3012
|
};
|
|
1862
3013
|
}
|
|
1863
|
-
|
|
3014
|
+
const path = resolvePath(teamPaths.clubSchedule.season, parsed);
|
|
3015
|
+
return nhlClient.get(path);
|
|
1864
3016
|
}
|
|
1865
3017
|
var schedule2 = {
|
|
1866
3018
|
season: scheduleSeason,
|
|
@@ -1868,6 +3020,49 @@ var schedule2 = {
|
|
|
1868
3020
|
month: scheduleMonth
|
|
1869
3021
|
};
|
|
1870
3022
|
|
|
1871
|
-
|
|
3023
|
+
// src/api/video.ts
|
|
3024
|
+
var video_exports = {};
|
|
3025
|
+
__export(video_exports, {
|
|
3026
|
+
metadata: () => metadata
|
|
3027
|
+
});
|
|
3028
|
+
var ACCOUNT_ID = "6415718365001";
|
|
3029
|
+
var POLICY_KEY = "BCpkADawqM3l37Vq8trLJ95vVwxubXYZXYglAopEZXQTHTWX3YdalyF9xmkuknxjBgiMYwt8VZ_OZ1jAjYxz_yzuNh_cjC3uOaMspVTD-hZfNUHtNnBnhVD0Gmsih8TBF8QlQFXiCQM3W_u4ydJ1qK2Rx8ZutCUg3PHb7Q";
|
|
3030
|
+
var brightcoveClient = createNHLClient({
|
|
3031
|
+
baseUrl: `https://edge.api.brightcove.com/playback/v1/accounts/${ACCOUNT_ID}`,
|
|
3032
|
+
headers: { Accept: `application/json;pk=${POLICY_KEY}` }
|
|
3033
|
+
});
|
|
3034
|
+
async function metadata(videoId) {
|
|
3035
|
+
const result = await brightcoveClient.get(
|
|
3036
|
+
`videos/${encodeURIComponent(String(videoId))}`
|
|
3037
|
+
);
|
|
3038
|
+
if (!result.success) return result;
|
|
3039
|
+
const video = result.data;
|
|
3040
|
+
const mp4 = video.sources.filter((s) => s.container === "MP4" && s.src?.startsWith("https:")).sort((a, b) => (b.width ?? 0) - (a.width ?? 0));
|
|
3041
|
+
return {
|
|
3042
|
+
success: true,
|
|
3043
|
+
data: {
|
|
3044
|
+
id: video.id,
|
|
3045
|
+
title: video.name,
|
|
3046
|
+
description: video.description,
|
|
3047
|
+
longDescription: video.long_description,
|
|
3048
|
+
duration: video.duration,
|
|
3049
|
+
publishedAt: video.published_at,
|
|
3050
|
+
poster: video.poster,
|
|
3051
|
+
thumbnail: video.thumbnail,
|
|
3052
|
+
url: mp4[0]?.src ?? null,
|
|
3053
|
+
sources: video.sources.map((s) => ({
|
|
3054
|
+
src: s.src,
|
|
3055
|
+
...s.type && { type: s.type },
|
|
3056
|
+
...s.container && { container: s.container },
|
|
3057
|
+
...s.codec && { codec: s.codec },
|
|
3058
|
+
...s.width && { width: s.width },
|
|
3059
|
+
...s.height && { height: s.height }
|
|
3060
|
+
})),
|
|
3061
|
+
tags: video.tags
|
|
3062
|
+
}
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
export { APIError, BASE_URLS, CayenneQueryBuilder, ClientError, EDGE, ErrorCategory, ErrorHandler, LogLevel as ErrorLogLevel, nhl_exports as NHL, NHLClient, NHLError, NetworkError, NotFoundError, ParseError, RateLimitError, ServerError, ValidationError, edge_adv_exports2 as adv, buildCayenneExp, config, createCayenneQuery, createNHLClient, gamecenter_exports as gc, logConfig, logger, edge_stats_exports as stats, video_exports as video, writeLog };
|
|
1872
3067
|
//# sourceMappingURL=index.js.map
|
|
1873
3068
|
//# sourceMappingURL=index.js.map
|