nhl-api-ts 0.1.0 → 0.2.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/README.md +22 -2
- package/dist/api/edge.d.mts +25 -24
- package/dist/api/game-center.d.mts +9 -8
- package/dist/api/helpers.d.mts +4 -3
- package/dist/api/misc.d.mts +6 -6
- package/dist/api/players.d.mts +4 -3
- package/dist/api/query/builder.d.mts +2 -0
- package/dist/api/query/builder.mjs +3 -1
- package/dist/api/query/index.d.mts +2 -2
- package/dist/api/query/index.mjs +1 -1
- package/dist/api/query/sorting/goalie-sorts.d.mts +55 -0
- package/dist/api/query/sorting/goalie-sorts.mjs +43 -48
- package/dist/api/query/sorting/sorting-options.d.mts +125 -0
- package/dist/api/query/sorting/sorting-options.mjs +3 -2
- package/dist/api/schedule.d.mts +12 -11
- package/dist/api/standings.d.mts +4 -3
- package/dist/api/stats.d.mts +19 -14
- package/dist/api/stats.mjs +23 -5
- package/dist/api/teams.d.mts +6 -5
- package/dist/index.d.mts +2 -1
- package/dist/nhl-client.d.mts +13 -9
- package/dist/nhl-client.mjs +1 -1
- package/dist/types/common.d.mts +81 -0
- package/dist/types/common.mjs +2 -0
- package/dist/types/edge.d.mts +1024 -0
- package/dist/types/edge.mjs +1 -0
- package/dist/types/game-center.d.mts +1194 -0
- package/dist/types/game-center.mjs +1 -0
- package/dist/types/helpers.d.mts +17 -0
- package/dist/types/helpers.mjs +1 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/misc.d.mts +68 -0
- package/dist/types/misc.mjs +2 -0
- package/dist/types/players.d.mts +42 -0
- package/dist/types/players.mjs +1 -0
- package/dist/types/schedule.d.mts +456 -0
- package/dist/types/schedule.mjs +1 -0
- package/dist/types/standings.d.mts +104 -0
- package/dist/types/standings.mjs +1 -0
- package/dist/types/stats.d.mts +1086 -0
- package/dist/types/stats.mjs +1 -0
- package/dist/types/teams.d.mts +29 -0
- package/dist/types/teams.mjs +1 -0
- package/dist/utils.d.mts +0 -1
- package/package.json +11 -3
- package/dist/api/query/errors.d.mts +0 -3
- package/dist/api/query/errors.mjs +0 -6
- package/dist/api/query/filters/base.d.mts +0 -4
- package/dist/api/query/filters/base.mjs +0 -2
- package/dist/api/query/filters/decision.d.mts +0 -13
- package/dist/api/query/filters/decision.mjs +0 -26
- package/dist/api/query/filters/draft.d.mts +0 -15
- package/dist/api/query/filters/draft.mjs +0 -27
- package/dist/api/query/filters/experience.d.mts +0 -9
- package/dist/api/query/filters/experience.mjs +0 -17
- package/dist/api/query/filters/franchise.d.mts +0 -9
- package/dist/api/query/filters/franchise.mjs +0 -15
- package/dist/api/query/filters/game-type.d.mts +0 -10
- package/dist/api/query/filters/game-type.mjs +0 -16
- package/dist/api/query/filters/goalie-sorts.d.mts +0 -3
- package/dist/api/query/filters/goalie-sorts.mjs +0 -55
- package/dist/api/query/filters/home-road.d.mts +0 -9
- package/dist/api/query/filters/home-road.mjs +0 -16
- package/dist/api/query/filters/index.d.mts +0 -14
- package/dist/api/query/filters/index.mjs +0 -14
- package/dist/api/query/filters/nationality.d.mts +0 -12
- package/dist/api/query/filters/nationality.mjs +0 -19
- package/dist/api/query/filters/opponent.d.mts +0 -10
- package/dist/api/query/filters/opponent.mjs +0 -16
- package/dist/api/query/filters/position.d.mts +0 -16
- package/dist/api/query/filters/position.mjs +0 -28
- package/dist/api/query/filters/season.d.mts +0 -14
- package/dist/api/query/filters/season.mjs +0 -24
- package/dist/api/query/filters/shoot-catch.d.mts +0 -9
- package/dist/api/query/filters/shoot-catch.mjs +0 -16
- package/dist/api/query/filters/status.d.mts +0 -20
- package/dist/api/query/filters/status.mjs +0 -28
- package/dist/logging.d.mts +0 -14
- package/dist/logging.mjs +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { LocalizedString, PositionCode, ShootsCatches } from '#src/types/common.mjs';
|
|
2
|
+
export interface Franchise {
|
|
3
|
+
id: number;
|
|
4
|
+
fullName: string;
|
|
5
|
+
teamCommonName: string;
|
|
6
|
+
teamPlaceName: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Roster {
|
|
9
|
+
forwards: RosterPlayer[];
|
|
10
|
+
defensemen: RosterPlayer[];
|
|
11
|
+
goalies: RosterPlayer[];
|
|
12
|
+
}
|
|
13
|
+
export interface RosterPlayer {
|
|
14
|
+
id: number;
|
|
15
|
+
headshot: string;
|
|
16
|
+
firstName: LocalizedString;
|
|
17
|
+
lastName: LocalizedString;
|
|
18
|
+
sweaterNumber?: number;
|
|
19
|
+
positionCode: PositionCode;
|
|
20
|
+
shootsCatches: ShootsCatches;
|
|
21
|
+
heightInInches: number;
|
|
22
|
+
weightInPounds: number;
|
|
23
|
+
heightInCentimeters: number;
|
|
24
|
+
weightInKilograms: number;
|
|
25
|
+
birthDate: string;
|
|
26
|
+
birthCity: LocalizedString;
|
|
27
|
+
birthCountry: string;
|
|
28
|
+
birthStateProvince?: LocalizedString;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** Identifiers accepted by the API: player ids, game ids, seasons, etc. */
|
|
2
2
|
export type Id = string | number;
|
|
3
|
-
export type JsonObject = Record<string, any>;
|
|
4
3
|
/** Sleeps for the given number of seconds. */
|
|
5
4
|
export declare const sleep: (seconds: number) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhl-api-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "TypeScript SDK and CLI for the NHL API and NHL EDGE stats.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nhl",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"source": "./src/*.mts",
|
|
35
35
|
"types": "./dist/*.d.mts",
|
|
36
36
|
"default": "./dist/*.mjs"
|
|
37
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"#probe/*.mjs": "./scripts/probe/*.mts"
|
|
38
39
|
},
|
|
39
40
|
"bin": {
|
|
40
41
|
"nhl-api-ts": "dist/cli.mjs"
|
|
@@ -74,7 +75,14 @@
|
|
|
74
75
|
"release": "pnpm build && changeset publish",
|
|
75
76
|
"typecheck": "pnpm exec tsc --noEmit",
|
|
76
77
|
"typecheck:examples": "pnpm exec tsc -p examples",
|
|
78
|
+
"typecheck:types": "pnpm exec tsc -p test/types",
|
|
79
|
+
"typecheck:scripts": "pnpm exec tsc -p scripts",
|
|
77
80
|
"api:report": "pnpm build && mkdir -p node_modules/.api-extractor && pnpm exec api-extractor run --local && cp node_modules/.api-extractor/nhl-api-ts.api.md api-report.md",
|
|
78
|
-
"docs:llms": "node scripts/build-llms-full.mts"
|
|
81
|
+
"docs:llms": "node scripts/build-llms-full.mts",
|
|
82
|
+
"probe:fetch": "node --conditions=source scripts/probe/fetch.mts",
|
|
83
|
+
"probe:infer": "node --conditions=source scripts/probe/infer.mts",
|
|
84
|
+
"probe:check": "node --conditions=source scripts/probe/check.mts",
|
|
85
|
+
"probe:fixtures": "node --conditions=source scripts/probe/fixtures.mts",
|
|
86
|
+
"openapi:schemas": "node --conditions=source scripts/probe/openapi.mts"
|
|
79
87
|
}
|
|
80
88
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export declare class DecisionQuery extends QueryBase {
|
|
3
|
-
readonly decision: string;
|
|
4
|
-
private readonly decisionQ;
|
|
5
|
-
/**
|
|
6
|
-
* Decision filter. W=win, L=loss, O=overtime loss.
|
|
7
|
-
* @param decision W, L, O
|
|
8
|
-
*/
|
|
9
|
-
constructor(decision: string);
|
|
10
|
-
toString(): string;
|
|
11
|
-
toQuery(): string;
|
|
12
|
-
validate(): boolean;
|
|
13
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { InvalidQueryValueException } from '#src/api/query/errors.mjs';
|
|
2
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
3
|
-
export class DecisionQuery extends QueryBase {
|
|
4
|
-
decision;
|
|
5
|
-
decisionQ = 'decision';
|
|
6
|
-
/**
|
|
7
|
-
* Decision filter. W=win, L=loss, O=overtime loss.
|
|
8
|
-
* @param decision W, L, O
|
|
9
|
-
*/
|
|
10
|
-
constructor(decision) {
|
|
11
|
-
super();
|
|
12
|
-
this.decision = decision;
|
|
13
|
-
}
|
|
14
|
-
toString() {
|
|
15
|
-
return `DecisionQuery: Value=${this.decision}`;
|
|
16
|
-
}
|
|
17
|
-
toQuery() {
|
|
18
|
-
return `${this.decisionQ}='${this.decision}'`;
|
|
19
|
-
}
|
|
20
|
-
validate() {
|
|
21
|
-
if (!['W', 'L', 'O'].includes(this.decision)) {
|
|
22
|
-
throw new InvalidQueryValueException('Decision value must be one of [W, L, O]');
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
import type { Id } from '#src/utils.mjs';
|
|
3
|
-
export declare class DraftQuery extends QueryBase {
|
|
4
|
-
readonly year: Id;
|
|
5
|
-
readonly round?: Id;
|
|
6
|
-
private readonly yearQ;
|
|
7
|
-
private readonly roundQ;
|
|
8
|
-
/**
|
|
9
|
-
* @param year Draft year
|
|
10
|
-
* @param draftRound Optional draft round. The API seems to default this to "1".
|
|
11
|
-
*/
|
|
12
|
-
constructor(year: Id, draftRound?: Id);
|
|
13
|
-
toQuery(): string;
|
|
14
|
-
validate(): boolean;
|
|
15
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class DraftQuery extends QueryBase {
|
|
3
|
-
year;
|
|
4
|
-
round;
|
|
5
|
-
yearQ = 'draftYear';
|
|
6
|
-
roundQ = 'draftRound';
|
|
7
|
-
/**
|
|
8
|
-
* @param year Draft year
|
|
9
|
-
* @param draftRound Optional draft round. The API seems to default this to "1".
|
|
10
|
-
*/
|
|
11
|
-
constructor(year, draftRound) {
|
|
12
|
-
super();
|
|
13
|
-
this.year = year;
|
|
14
|
-
this.round = draftRound;
|
|
15
|
-
}
|
|
16
|
-
toQuery() {
|
|
17
|
-
let query = `${this.yearQ}=${this.year}`;
|
|
18
|
-
if (this.round) {
|
|
19
|
-
query += ' and ';
|
|
20
|
-
query += `${this.roundQ}=${this.round}`;
|
|
21
|
-
}
|
|
22
|
-
return query;
|
|
23
|
-
}
|
|
24
|
-
validate() {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export declare class ExperienceQuery extends QueryBase {
|
|
3
|
-
readonly isRookie: boolean;
|
|
4
|
-
private readonly experienceQ;
|
|
5
|
-
/** Experience filter. true = rookies only, false = veterans only. */
|
|
6
|
-
constructor(isRookie: boolean);
|
|
7
|
-
toQuery(): string;
|
|
8
|
-
validate(): boolean;
|
|
9
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class ExperienceQuery extends QueryBase {
|
|
3
|
-
isRookie;
|
|
4
|
-
experienceQ = 'isRookie';
|
|
5
|
-
/** Experience filter. true = rookies only, false = veterans only. */
|
|
6
|
-
constructor(isRookie) {
|
|
7
|
-
super();
|
|
8
|
-
this.isRookie = isRookie;
|
|
9
|
-
}
|
|
10
|
-
toQuery() {
|
|
11
|
-
const val = this.isRookie ? '1' : '0';
|
|
12
|
-
return `${this.experienceQ}='${val}'`;
|
|
13
|
-
}
|
|
14
|
-
validate() {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
import type { Id } from '#src/utils.mjs';
|
|
3
|
-
export declare class FranchiseQuery extends QueryBase {
|
|
4
|
-
readonly franchiseId: Id;
|
|
5
|
-
private readonly franchiseQ;
|
|
6
|
-
constructor(franchiseId: Id);
|
|
7
|
-
toQuery(): string;
|
|
8
|
-
validate(): boolean;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class FranchiseQuery extends QueryBase {
|
|
3
|
-
franchiseId;
|
|
4
|
-
franchiseQ = 'franchiseId';
|
|
5
|
-
constructor(franchiseId) {
|
|
6
|
-
super();
|
|
7
|
-
this.franchiseId = franchiseId;
|
|
8
|
-
}
|
|
9
|
-
toQuery() {
|
|
10
|
-
return `${this.franchiseQ}=${this.franchiseId}`;
|
|
11
|
-
}
|
|
12
|
-
validate() {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
import type { Id } from '#src/utils.mjs';
|
|
3
|
-
export declare class GameTypeQuery extends QueryBase {
|
|
4
|
-
readonly gameType: Id;
|
|
5
|
-
private readonly gameTypeQ;
|
|
6
|
-
/** @param gameType 1=Preseason, 2=Regular season, 3=Playoffs */
|
|
7
|
-
constructor(gameType: Id);
|
|
8
|
-
toQuery(): string;
|
|
9
|
-
validate(): boolean;
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class GameTypeQuery extends QueryBase {
|
|
3
|
-
gameType;
|
|
4
|
-
gameTypeQ = 'gameTypeId';
|
|
5
|
-
/** @param gameType 1=Preseason, 2=Regular season, 3=Playoffs */
|
|
6
|
-
constructor(gameType) {
|
|
7
|
-
super();
|
|
8
|
-
this.gameType = gameType;
|
|
9
|
-
}
|
|
10
|
-
toQuery() {
|
|
11
|
-
return `${this.gameTypeQ}=${this.gameType}`;
|
|
12
|
-
}
|
|
13
|
-
validate() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/** Default sorting criteria for goalie stats reports. */
|
|
2
|
-
export function goalieStatsSorts(report) {
|
|
3
|
-
switch (report) {
|
|
4
|
-
case 'summary':
|
|
5
|
-
return [
|
|
6
|
-
{ property: 'wins', direction: 'DESC' },
|
|
7
|
-
{ property: 'gamesPlayed', direction: 'ASC' },
|
|
8
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
9
|
-
];
|
|
10
|
-
case 'advanced':
|
|
11
|
-
return [
|
|
12
|
-
{ property: 'qualityStart', direction: 'DESC' },
|
|
13
|
-
{ property: 'goalsAgainstAverage', direction: 'ASC' },
|
|
14
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
15
|
-
];
|
|
16
|
-
case 'bios':
|
|
17
|
-
return [
|
|
18
|
-
{ property: 'lastName', direction: 'ASC_CI' },
|
|
19
|
-
{ property: 'goalieFullName', direction: 'ASC_CI' },
|
|
20
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
21
|
-
];
|
|
22
|
-
case 'daysrest':
|
|
23
|
-
return [
|
|
24
|
-
{ property: 'wins', direction: 'DESC' },
|
|
25
|
-
{ property: 'savePct', direction: 'DESC' },
|
|
26
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
27
|
-
];
|
|
28
|
-
case 'penaltyShots':
|
|
29
|
-
return [
|
|
30
|
-
{ property: 'penaltyShotsSaves', direction: 'DESC' },
|
|
31
|
-
{ property: 'penaltyShotSavePct', direction: 'DESC' },
|
|
32
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
33
|
-
];
|
|
34
|
-
case 'savesByStrength':
|
|
35
|
-
return [
|
|
36
|
-
{ property: 'wins', direction: 'DESC' },
|
|
37
|
-
{ property: 'savePct', direction: 'DESC' },
|
|
38
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
39
|
-
];
|
|
40
|
-
case 'shootout':
|
|
41
|
-
return [
|
|
42
|
-
{ property: 'shootoutWins', direction: 'DESC' },
|
|
43
|
-
{ property: 'shootoutSavePct', direction: 'DESC' },
|
|
44
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
45
|
-
];
|
|
46
|
-
case 'startedVsRelieved':
|
|
47
|
-
return [
|
|
48
|
-
{ property: 'gamesStarted', direction: 'DESC' },
|
|
49
|
-
{ property: 'gamesStartedSavePct', direction: 'DESC' },
|
|
50
|
-
{ property: 'playerId', direction: 'ASC' },
|
|
51
|
-
];
|
|
52
|
-
default:
|
|
53
|
-
return [{}];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export declare class HomeRoadQuery extends QueryBase {
|
|
3
|
-
readonly homeRoad: string;
|
|
4
|
-
private readonly homeRoadQ;
|
|
5
|
-
/** @param homeRoad H or R to indicate home or road games. */
|
|
6
|
-
constructor(homeRoad: string);
|
|
7
|
-
toQuery(): string;
|
|
8
|
-
validate(): boolean;
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class HomeRoadQuery extends QueryBase {
|
|
3
|
-
homeRoad;
|
|
4
|
-
homeRoadQ = 'homeRoad';
|
|
5
|
-
/** @param homeRoad H or R to indicate home or road games. */
|
|
6
|
-
constructor(homeRoad) {
|
|
7
|
-
super();
|
|
8
|
-
this.homeRoad = homeRoad;
|
|
9
|
-
}
|
|
10
|
-
toQuery() {
|
|
11
|
-
return `${this.homeRoadQ}='${this.homeRoad}'`;
|
|
12
|
-
}
|
|
13
|
-
validate() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export { DecisionQuery } from '#src/api/query/filters/decision.mjs';
|
|
3
|
-
export { DraftQuery } from '#src/api/query/filters/draft.mjs';
|
|
4
|
-
export { ExperienceQuery } from '#src/api/query/filters/experience.mjs';
|
|
5
|
-
export { FranchiseQuery } from '#src/api/query/filters/franchise.mjs';
|
|
6
|
-
export { GameTypeQuery } from '#src/api/query/filters/game-type.mjs';
|
|
7
|
-
export { goalieStatsSorts } from '#src/api/query/filters/goalie-sorts.mjs';
|
|
8
|
-
export { HomeRoadQuery } from '#src/api/query/filters/home-road.mjs';
|
|
9
|
-
export { NationalityQuery } from '#src/api/query/filters/nationality.mjs';
|
|
10
|
-
export { OpponentQuery } from '#src/api/query/filters/opponent.mjs';
|
|
11
|
-
export { PositionQuery, PositionTypes, } from '#src/api/query/filters/position.mjs';
|
|
12
|
-
export { SeasonQuery } from '#src/api/query/filters/season.mjs';
|
|
13
|
-
export { ShootCatchesQuery } from '#src/api/query/filters/shoot-catch.mjs';
|
|
14
|
-
export { StatusQuery, type StatusQueryOptions, } from '#src/api/query/filters/status.mjs';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export { DecisionQuery } from '#src/api/query/filters/decision.mjs';
|
|
3
|
-
export { DraftQuery } from '#src/api/query/filters/draft.mjs';
|
|
4
|
-
export { ExperienceQuery } from '#src/api/query/filters/experience.mjs';
|
|
5
|
-
export { FranchiseQuery } from '#src/api/query/filters/franchise.mjs';
|
|
6
|
-
export { GameTypeQuery } from '#src/api/query/filters/game-type.mjs';
|
|
7
|
-
export { goalieStatsSorts } from '#src/api/query/filters/goalie-sorts.mjs';
|
|
8
|
-
export { HomeRoadQuery } from '#src/api/query/filters/home-road.mjs';
|
|
9
|
-
export { NationalityQuery } from '#src/api/query/filters/nationality.mjs';
|
|
10
|
-
export { OpponentQuery } from '#src/api/query/filters/opponent.mjs';
|
|
11
|
-
export { PositionQuery, PositionTypes, } from '#src/api/query/filters/position.mjs';
|
|
12
|
-
export { SeasonQuery } from '#src/api/query/filters/season.mjs';
|
|
13
|
-
export { ShootCatchesQuery } from '#src/api/query/filters/shoot-catch.mjs';
|
|
14
|
-
export { StatusQuery, } from '#src/api/query/filters/status.mjs';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Country/Nationality codes can be found via the `client.misc.countries()`
|
|
4
|
-
* endpoint, e.g. "CAN", "USA", "SWE", "FIN", "CZE", "RUS".
|
|
5
|
-
*/
|
|
6
|
-
export declare class NationalityQuery extends QueryBase {
|
|
7
|
-
readonly nationCode: string;
|
|
8
|
-
private readonly nationQ;
|
|
9
|
-
constructor(nationCode: string);
|
|
10
|
-
validate(): boolean;
|
|
11
|
-
toQuery(): string;
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Country/Nationality codes can be found via the `client.misc.countries()`
|
|
4
|
-
* endpoint, e.g. "CAN", "USA", "SWE", "FIN", "CZE", "RUS".
|
|
5
|
-
*/
|
|
6
|
-
export class NationalityQuery extends QueryBase {
|
|
7
|
-
nationCode;
|
|
8
|
-
nationQ = 'nationalityCode';
|
|
9
|
-
constructor(nationCode) {
|
|
10
|
-
super();
|
|
11
|
-
this.nationCode = nationCode;
|
|
12
|
-
}
|
|
13
|
-
validate() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
toQuery() {
|
|
17
|
-
return `${this.nationQ}='${this.nationCode}'`;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
import type { Id } from '#src/utils.mjs';
|
|
3
|
-
export declare class OpponentQuery extends QueryBase {
|
|
4
|
-
readonly opponentId: Id;
|
|
5
|
-
private readonly opponentQ;
|
|
6
|
-
/** Opponent filter. Takes in the ID of the opponent franchise. */
|
|
7
|
-
constructor(opponentFranchiseId: Id);
|
|
8
|
-
toQuery(): string;
|
|
9
|
-
validate(): boolean;
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class OpponentQuery extends QueryBase {
|
|
3
|
-
opponentId;
|
|
4
|
-
opponentQ = 'opponentFranchiseId';
|
|
5
|
-
/** Opponent filter. Takes in the ID of the opponent franchise. */
|
|
6
|
-
constructor(opponentFranchiseId) {
|
|
7
|
-
super();
|
|
8
|
-
this.opponentId = opponentFranchiseId;
|
|
9
|
-
}
|
|
10
|
-
toQuery() {
|
|
11
|
-
return `${this.opponentQ}=${this.opponentId}`;
|
|
12
|
-
}
|
|
13
|
-
validate() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export declare const PositionTypes: {
|
|
3
|
-
readonly ALL_FORWARDS: 'F';
|
|
4
|
-
readonly CENTER: 'C';
|
|
5
|
-
readonly LEFT_WING: 'L';
|
|
6
|
-
readonly RIGHT_WING: 'R';
|
|
7
|
-
readonly DEFENSE: 'D';
|
|
8
|
-
};
|
|
9
|
-
export type PositionTypes = (typeof PositionTypes)[keyof typeof PositionTypes];
|
|
10
|
-
export declare class PositionQuery extends QueryBase {
|
|
11
|
-
readonly position: PositionTypes;
|
|
12
|
-
private readonly positionQ;
|
|
13
|
-
constructor(position: PositionTypes);
|
|
14
|
-
toQuery(): string;
|
|
15
|
-
validate(): boolean;
|
|
16
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export const PositionTypes = {
|
|
3
|
-
ALL_FORWARDS: 'F',
|
|
4
|
-
CENTER: 'C',
|
|
5
|
-
LEFT_WING: 'L',
|
|
6
|
-
RIGHT_WING: 'R',
|
|
7
|
-
DEFENSE: 'D',
|
|
8
|
-
};
|
|
9
|
-
export class PositionQuery extends QueryBase {
|
|
10
|
-
position;
|
|
11
|
-
positionQ = 'positionCode';
|
|
12
|
-
constructor(position) {
|
|
13
|
-
super();
|
|
14
|
-
this.position = position;
|
|
15
|
-
}
|
|
16
|
-
toQuery() {
|
|
17
|
-
// All forwards require an OR clause
|
|
18
|
-
if (this.position === PositionTypes.ALL_FORWARDS) {
|
|
19
|
-
return (`(${this.positionQ}='${PositionTypes.LEFT_WING}' ` +
|
|
20
|
-
`or ${this.positionQ}='${PositionTypes.RIGHT_WING}' ` +
|
|
21
|
-
`or ${this.positionQ}='${PositionTypes.CENTER}')`);
|
|
22
|
-
}
|
|
23
|
-
return `${this.positionQ}='${this.position}'`;
|
|
24
|
-
}
|
|
25
|
-
validate() {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
import type { Id } from '#src/utils.mjs';
|
|
3
|
-
export declare class SeasonQuery extends QueryBase {
|
|
4
|
-
readonly seasonStart: Id;
|
|
5
|
-
readonly seasonEnd: Id;
|
|
6
|
-
private readonly seasonStartQ;
|
|
7
|
-
private readonly seasonStartQExp;
|
|
8
|
-
private readonly seasonEndQ;
|
|
9
|
-
private readonly seasonEndQExp;
|
|
10
|
-
/** Seasons in YYYYYYYY format, e.g. 20232024. */
|
|
11
|
-
constructor(seasonStart: Id, seasonEnd: Id);
|
|
12
|
-
toQuery(): string;
|
|
13
|
-
validate(): boolean;
|
|
14
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class SeasonQuery extends QueryBase {
|
|
3
|
-
seasonStart;
|
|
4
|
-
seasonEnd;
|
|
5
|
-
seasonStartQ = 'seasonId';
|
|
6
|
-
seasonStartQExp = '>=';
|
|
7
|
-
seasonEndQ = 'seasonId';
|
|
8
|
-
seasonEndQExp = '<=';
|
|
9
|
-
/** Seasons in YYYYYYYY format, e.g. 20232024. */
|
|
10
|
-
constructor(seasonStart, seasonEnd) {
|
|
11
|
-
super();
|
|
12
|
-
this.seasonStart = seasonStart;
|
|
13
|
-
this.seasonEnd = seasonEnd;
|
|
14
|
-
}
|
|
15
|
-
toQuery() {
|
|
16
|
-
let query = `${this.seasonStartQ} ${this.seasonStartQExp} ${this.seasonStart}`;
|
|
17
|
-
query += ' and ';
|
|
18
|
-
query += `${this.seasonEndQ} ${this.seasonEndQExp} ${this.seasonEnd}`;
|
|
19
|
-
return query;
|
|
20
|
-
}
|
|
21
|
-
validate() {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export declare class ShootCatchesQuery extends QueryBase {
|
|
3
|
-
readonly shootCatch: string;
|
|
4
|
-
readonly shootCatchQ = "shootsCatches";
|
|
5
|
-
/** Shoot / catch filter. @param shootCatch L or R */
|
|
6
|
-
constructor(shootCatch: string);
|
|
7
|
-
toQuery(): string;
|
|
8
|
-
validate(): boolean;
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class ShootCatchesQuery extends QueryBase {
|
|
3
|
-
shootCatch;
|
|
4
|
-
shootCatchQ = 'shootsCatches';
|
|
5
|
-
/** Shoot / catch filter. @param shootCatch L or R */
|
|
6
|
-
constructor(shootCatch) {
|
|
7
|
-
super();
|
|
8
|
-
this.shootCatch = shootCatch;
|
|
9
|
-
}
|
|
10
|
-
toQuery() {
|
|
11
|
-
return `${this.shootCatchQ}='${this.shootCatch}'`;
|
|
12
|
-
}
|
|
13
|
-
validate() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export interface StatusQueryOptions {
|
|
3
|
-
/** Only current active players. */
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
/** Only Hall of Fame players. Takes precedence over `isActive`. */
|
|
6
|
-
isHallOfFame?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class StatusQuery extends QueryBase {
|
|
9
|
-
readonly isActive: boolean;
|
|
10
|
-
readonly isHallOfFame: boolean;
|
|
11
|
-
private readonly activeQ;
|
|
12
|
-
private readonly hofQ;
|
|
13
|
-
/**
|
|
14
|
-
* Player status. Not supplying either option matches active and inactive
|
|
15
|
-
* players.
|
|
16
|
-
*/
|
|
17
|
-
constructor({ isActive, isHallOfFame, }?: StatusQueryOptions);
|
|
18
|
-
toQuery(): string;
|
|
19
|
-
validate(): boolean;
|
|
20
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { QueryBase } from '#src/api/query/filters/base.mjs';
|
|
2
|
-
export class StatusQuery extends QueryBase {
|
|
3
|
-
isActive;
|
|
4
|
-
isHallOfFame;
|
|
5
|
-
activeQ = 'active';
|
|
6
|
-
hofQ = 'isInHallOfFame';
|
|
7
|
-
/**
|
|
8
|
-
* Player status. Not supplying either option matches active and inactive
|
|
9
|
-
* players.
|
|
10
|
-
*/
|
|
11
|
-
constructor({ isActive = false, isHallOfFame = false, } = {}) {
|
|
12
|
-
super();
|
|
13
|
-
this.isActive = isActive;
|
|
14
|
-
this.isHallOfFame = isHallOfFame;
|
|
15
|
-
}
|
|
16
|
-
toQuery() {
|
|
17
|
-
if (this.isHallOfFame) {
|
|
18
|
-
return `${this.hofQ}=1`;
|
|
19
|
-
}
|
|
20
|
-
if (this.isActive) {
|
|
21
|
-
return `${this.activeQ}=1`;
|
|
22
|
-
}
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
validate() {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
}
|
package/dist/logging.d.mts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { styleText } from 'node:util';
|
|
2
|
-
export type Style = Parameters<typeof styleText>[0];
|
|
3
|
-
export declare const toStdout: (format: Style) => (text: string) => string;
|
|
4
|
-
export declare const toStderr: (format: Style) => (text: string) => string;
|
|
5
|
-
export declare const colors: {
|
|
6
|
-
dim: (text: string) => string;
|
|
7
|
-
pass: (text: string) => string;
|
|
8
|
-
fail: (text: string) => string;
|
|
9
|
-
ok: (text: string) => string;
|
|
10
|
-
success: (text: string) => string;
|
|
11
|
-
error: (text: string) => string;
|
|
12
|
-
warn: (text: string) => string;
|
|
13
|
-
bold: (text: string) => string;
|
|
14
|
-
};
|
package/dist/logging.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { styleText } from 'node:util';
|
|
2
|
-
export const toStdout = (format) => (text) => styleText(format, text, { stream: process.stdout });
|
|
3
|
-
export const toStderr = (format) => (text) => styleText(format, text, { stream: process.stderr });
|
|
4
|
-
export const colors = {
|
|
5
|
-
dim: toStdout('dim'),
|
|
6
|
-
pass: toStdout(['bold', 'green']),
|
|
7
|
-
fail: toStdout(['bold', 'red']),
|
|
8
|
-
ok: toStdout('green'),
|
|
9
|
-
success: toStdout(['bold', 'green']),
|
|
10
|
-
error: toStderr('red'),
|
|
11
|
-
warn: toStderr('yellow'),
|
|
12
|
-
bold: toStderr('bold'),
|
|
13
|
-
};
|