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