nhl-api-ts 0.2.0 → 0.3.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.
Files changed (51) hide show
  1. package/README.md +81 -9
  2. package/dist/api/draft.d.mts +61 -0
  3. package/dist/api/draft.mjs +68 -0
  4. package/dist/api/edge.d.mts +221 -24
  5. package/dist/api/edge.mjs +276 -27
  6. package/dist/api/game-center.d.mts +63 -15
  7. package/dist/api/game-center.mjs +67 -8
  8. package/dist/api/helpers.d.mts +6 -6
  9. package/dist/api/helpers.mjs +6 -6
  10. package/dist/api/misc.d.mts +120 -6
  11. package/dist/api/misc.mjs +162 -7
  12. package/dist/api/players.d.mts +59 -7
  13. package/dist/api/players.mjs +85 -4
  14. package/dist/api/query/cayenne.d.mts +4 -0
  15. package/dist/api/query/cayenne.mjs +13 -0
  16. package/dist/api/query/sorting/sorting-options.d.mts +8 -0
  17. package/dist/api/query/sorting/sorting-options.mjs +30 -0
  18. package/dist/api/schedule.d.mts +36 -23
  19. package/dist/api/schedule.mjs +40 -16
  20. package/dist/api/standings.d.mts +3 -3
  21. package/dist/api/standings.mjs +4 -4
  22. package/dist/api/stats.d.mts +105 -16
  23. package/dist/api/stats.mjs +145 -41
  24. package/dist/api/teams.d.mts +48 -8
  25. package/dist/api/teams.mjs +59 -7
  26. package/dist/cli/colors.d.mts +2 -2
  27. package/dist/cli/colors.mjs +6 -2
  28. package/dist/cli/commands.mjs +521 -46
  29. package/dist/cli/run.mjs +7 -5
  30. package/dist/http-client.d.mts +2 -1
  31. package/dist/http-client.mjs +10 -3
  32. package/dist/index.d.mts +8 -2
  33. package/dist/index.mjs +3 -0
  34. package/dist/nhl-client.d.mts +70 -15
  35. package/dist/nhl-client.mjs +40 -17
  36. package/dist/types/common.d.mts +0 -1
  37. package/dist/types/draft.d.mts +97 -0
  38. package/dist/types/draft.mjs +1 -0
  39. package/dist/types/edge.d.mts +301 -5
  40. package/dist/types/game-center.d.mts +277 -119
  41. package/dist/types/index.d.mts +1 -0
  42. package/dist/types/misc.d.mts +101 -0
  43. package/dist/types/misc.mjs +0 -1
  44. package/dist/types/players.d.mts +23 -2
  45. package/dist/types/schedule.d.mts +50 -62
  46. package/dist/types/standings.d.mts +1 -2
  47. package/dist/types/stats.d.mts +313 -111
  48. package/dist/types/teams.d.mts +29 -1
  49. package/dist/utils.d.mts +1 -1
  50. package/dist/utils.mjs +3 -1
  51. package/package.json +7 -28
@@ -1,4 +1,5 @@
1
- import type { LocalizedString, PositionCode, ShootsCatches } from '#src/types/common.mjs';
1
+ import type { LocalizedString, OpenUnion, PositionCode, ShootsCatches } from '#src/types/common.mjs';
2
+ import type { ScoreboardDate } from '#src/types/game-center.mjs';
2
3
  export interface Franchise {
3
4
  id: number;
4
5
  fullName: string;
@@ -27,3 +28,30 @@ export interface RosterPlayer {
27
28
  birthCountry: string;
28
29
  birthStateProvince?: LocalizedString;
29
30
  }
31
+ /** One team of the stats API (`en/team`), past or present. */
32
+ export interface StatsTeam {
33
+ id: number;
34
+ /** `null` for the placeholder teams (TBD, NHL) */
35
+ franchiseId: number | null;
36
+ fullName: string;
37
+ leagueId: number;
38
+ rawTricode: string;
39
+ triCode: string;
40
+ }
41
+ export interface StatsTeamLogo {
42
+ id: number;
43
+ background: OpenUnion<'light' | 'dark' | 'alt' | 'black'>;
44
+ endSeason: number;
45
+ secureUrl: string;
46
+ startSeason: number;
47
+ teamId: number;
48
+ url: string;
49
+ }
50
+ export interface TeamScoreboard {
51
+ focusedDate: string;
52
+ focusedDateCount: number;
53
+ clubTimeZone: string;
54
+ clubUTCOffset: string;
55
+ clubScheduleLink: string;
56
+ gamesByDate: ScoreboardDate[];
57
+ }
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Identifiers accepted by the API: player ids, game ids, seasons, etc. */
2
2
  export type Id = string | number;
3
3
  /** Sleeps for the given number of seconds. */
4
- export declare const sleep: (seconds: number) => Promise<void>;
4
+ export declare function sleep(seconds: number): Promise<void>;
package/dist/utils.mjs CHANGED
@@ -1,3 +1,5 @@
1
1
  import { setTimeout as delay } from 'node:timers/promises';
2
2
  /** Sleeps for the given number of seconds. */
3
- export const sleep = (seconds) => delay(seconds * 1000);
3
+ export function sleep(seconds) {
4
+ return delay(seconds * 1000);
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhl-api-ts",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript SDK and CLI for the NHL API and NHL EDGE stats.",
5
5
  "keywords": [
6
6
  "nhl",
@@ -16,7 +16,8 @@
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git+https://github.com/andrewangelle/nhl-api-ts.git"
19
+ "url": "git+https://github.com/andrewangelle/nhl-api-ts.git",
20
+ "directory": "packages/nhl-api-ts"
20
21
  },
21
22
  "type": "module",
22
23
  "sideEffects": false,
@@ -24,6 +25,7 @@
24
25
  "types": "dist/index.d.mts",
25
26
  "exports": {
26
27
  ".": {
28
+ "source": "./src/index.mts",
27
29
  "types": "./dist/index.d.mts",
28
30
  "default": "./dist/index.mjs"
29
31
  },
@@ -34,8 +36,7 @@
34
36
  "source": "./src/*.mts",
35
37
  "types": "./dist/*.d.mts",
36
38
  "default": "./dist/*.mjs"
37
- },
38
- "#probe/*.mjs": "./scripts/probe/*.mts"
39
+ }
39
40
  },
40
41
  "bin": {
41
42
  "nhl-api-ts": "dist/cli.mjs"
@@ -47,42 +48,20 @@
47
48
  "dist"
48
49
  ],
49
50
  "devDependencies": {
50
- "@biomejs/biome": "^2.5.15",
51
- "@changesets/changelog-github": "^1.0.1",
52
- "@changesets/cli": "^3.0.3",
53
51
  "@microsoft/api-extractor": "^7.59.4",
54
52
  "@types/node": "^26.2.0",
55
- "husky": "^9.1.7",
56
- "lint-staged": "^17.3.0",
57
53
  "typescript": "^7.0.2"
58
54
  },
59
- "lint-staged": {
60
- "*.{ts,tsx,js,jsx,mts,mjs}": [
61
- "pnpm lint:fix",
62
- "pnpm format"
63
- ]
64
- },
65
55
  "scripts": {
66
56
  "build": "pnpm exec tsc",
67
57
  "test": "node --conditions=source --test \"test/**/*.test.mts\"",
68
58
  "test:update-snapshots": "node --conditions=source --test --test-update-snapshots \"test/**/*.test.mts\"",
69
- "lint:fix": "pnpm exec biome check . --write",
70
- "lint:check": "pnpm exec biome check .",
71
- "format": "pnpm exec biome format . --write",
72
- "pre-commit": "lint-staged",
73
- "changeset": "changeset",
74
- "version-packages": "changeset version",
75
- "release": "pnpm build && changeset publish",
76
59
  "typecheck": "pnpm exec tsc --noEmit",
60
+ "typecheck:test": "pnpm exec tsc -p test",
77
61
  "typecheck:examples": "pnpm exec tsc -p examples",
78
62
  "typecheck:types": "pnpm exec tsc -p test/types",
79
63
  "typecheck:scripts": "pnpm exec tsc -p scripts",
80
64
  "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",
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"
65
+ "docs:llms": "node scripts/build-llms-full.mts"
87
66
  }
88
67
  }