tbarequest 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.js +69 -0
  3. package/dist/types/endpoints/districts.d.ts +161 -0
  4. package/dist/types/endpoints/districts.js +50 -0
  5. package/dist/types/endpoints/events.d.ts +1500 -0
  6. package/dist/types/endpoints/events.js +153 -0
  7. package/dist/types/endpoints/index.d.ts +25 -0
  8. package/dist/types/endpoints/index.js +25 -0
  9. package/dist/types/endpoints/insights.d.ts +29 -0
  10. package/dist/types/endpoints/insights.js +12 -0
  11. package/dist/types/endpoints/matches.d.ts +1101 -0
  12. package/dist/types/endpoints/matches.js +23 -0
  13. package/dist/types/endpoints/regionalAdvancements.d.ts +32 -0
  14. package/dist/types/endpoints/regionalAdvancements.js +12 -0
  15. package/dist/types/endpoints/status.d.ts +19 -0
  16. package/dist/types/endpoints/status.js +16 -0
  17. package/dist/types/endpoints/teams.d.ts +2713 -0
  18. package/dist/types/endpoints/teams.js +162 -0
  19. package/dist/types/index.d.ts +11 -0
  20. package/dist/types/index.js +1 -0
  21. package/dist/types/schemas/districts.d.ts +25 -0
  22. package/dist/types/schemas/districts.js +28 -0
  23. package/dist/types/schemas/events.d.ts +186 -0
  24. package/dist/types/schemas/events.js +109 -0
  25. package/dist/types/schemas/insights.d.ts +21 -0
  26. package/dist/types/schemas/insights.js +22 -0
  27. package/dist/types/schemas/matches.d.ts +2781 -0
  28. package/dist/types/schemas/matches.js +597 -0
  29. package/dist/types/schemas/regionalAdvancements.d.ts +22 -0
  30. package/dist/types/schemas/regionalAdvancements.js +23 -0
  31. package/dist/types/schemas/status.d.ts +4 -0
  32. package/dist/types/schemas/status.js +5 -0
  33. package/dist/types/schemas/teams.d.ts +52 -0
  34. package/dist/types/schemas/teams.js +41 -0
  35. package/dist/utils.d.ts +11 -0
  36. package/dist/utils.js +9 -0
  37. package/package.json +1 -1
@@ -0,0 +1,153 @@
1
+ import { Elimination_Alliance, Event, Event_Simple, Team_Event_Status, WLT_Record, } from "../schemas/events.js";
2
+ import { Award, Media, Team, Team_Simple } from "../schemas/teams.js";
3
+ import { Match, Match_Simple } from "../schemas/matches.js";
4
+ import { type } from "arktype";
5
+ const rankings = type({
6
+ rankings: type({
7
+ matches_played: "number",
8
+ qual_average: "number | null",
9
+ extra_stats: "number[]",
10
+ sort_orders: "number[] | null",
11
+ record: type(WLT_Record, "|", "null"),
12
+ rank: "number",
13
+ dq: "number",
14
+ team_key: "string",
15
+ }).array(),
16
+ extra_stats_info: type({
17
+ precision: "number",
18
+ name: "string",
19
+ }).array(),
20
+ sort_order_info: type({
21
+ precision: "number",
22
+ name: "string",
23
+ }).array(),
24
+ });
25
+ const eventPoints = type({
26
+ points: type({
27
+ "[string]": type({
28
+ total: "number",
29
+ alliance_points: "number",
30
+ elim_points: "number",
31
+ award_points: "number",
32
+ qual_points: "number",
33
+ }),
34
+ }),
35
+ "tiebreakers?": type({
36
+ "[string]": type({
37
+ highest_qual_scores: "number[]",
38
+ qual_points: "number",
39
+ }).partial(),
40
+ }),
41
+ });
42
+ export const eventEndpoints = {
43
+ "/events/{year}": {
44
+ schema: Event.array(),
45
+ arguments: type(["number"]),
46
+ },
47
+ "/events/{year}/simple": {
48
+ schema: Event_Simple.array(),
49
+ arguments: type(["number"]),
50
+ },
51
+ "/events/{year}/keys": {
52
+ schema: type("string[]"),
53
+ arguments: type(["number"]),
54
+ },
55
+ "/event/{event_key}": {
56
+ schema: Event,
57
+ arguments: type(["string"]),
58
+ },
59
+ "/event/{event_key}/simple": {
60
+ schema: Event_Simple,
61
+ arguments: type(["string"]),
62
+ },
63
+ "/event/{event_key}/alliances": {
64
+ schema: type(Elimination_Alliance.array(), "|", "null"),
65
+ arguments: type(["string"]),
66
+ },
67
+ "/event/{event_key}/insights": {
68
+ schema: type({
69
+ qual: "unknown",
70
+ playoff: "unknown",
71
+ }, "|", "null"),
72
+ arguments: type(["string"]),
73
+ },
74
+ "/event/{event_key}/oprs": {
75
+ schema: type({
76
+ oprs: { "[string]": "number" },
77
+ dprs: { "[string]": "number" },
78
+ ccwms: { "[string]": "number" },
79
+ }),
80
+ arguments: type(["string"]),
81
+ },
82
+ "/event/{event_key}/coprs": {
83
+ schema: type({ "[string]": { "[string]": "number" } }),
84
+ arguments: type(["string"]),
85
+ },
86
+ "/event/{event_key}/predictions": {
87
+ schema: type({ "[string]": "unknown" }, "|", "null"),
88
+ arguments: type(["string"]),
89
+ },
90
+ "/event/{event_key}/rankings": {
91
+ schema: type(rankings, "|", "null"),
92
+ arguments: type(["string"]),
93
+ },
94
+ "/event/{event_key}/district_points": {
95
+ schema: type(eventPoints, "|", "null"),
96
+ arguments: type(["string"]),
97
+ },
98
+ "/event/{event_key}/regional_champs_pool_points": {
99
+ schema: type(eventPoints, "|", "null"),
100
+ arguments: type(["string"]),
101
+ },
102
+ "/event/{event_key}/advancement_points": {
103
+ schema: type(eventPoints, "|", "null"),
104
+ arguments: type(["string"]),
105
+ },
106
+ "/event/{event_key}/teams": {
107
+ schema: Team.array(),
108
+ arguments: type(["string"]),
109
+ },
110
+ "/event/{event_key}/teams/simple": {
111
+ schema: Team_Simple.array(),
112
+ arguments: type(["string"]),
113
+ },
114
+ "/event/{event_key}/teams/keys": {
115
+ schema: type("string[]"),
116
+ arguments: type(["string"]),
117
+ },
118
+ "/event/{event_key}/teams/statuses": {
119
+ schema: type({ "[string]": Team_Event_Status }),
120
+ arguments: type(["string"]),
121
+ },
122
+ "/event/{event_key}/matches": {
123
+ schema: Match.array(),
124
+ arguments: type(["string"]),
125
+ transformMatch: ({ key }, schema) => {
126
+ if (key &&
127
+ parseInt(key.slice(0, 4)) &&
128
+ Array.isArray(schema) &&
129
+ schema.every((v) => v && typeof v === "object")) {
130
+ for (const member of schema) {
131
+ member["score_breakdown"]["yearOfCompetition"] = parseInt(key.slice(0, 4));
132
+ }
133
+ }
134
+ return schema;
135
+ },
136
+ },
137
+ "/event/{event_key}/matches/simple": {
138
+ schema: Match_Simple.array(),
139
+ arguments: type(["string"]),
140
+ },
141
+ "/event/{event_key}/matches/keys": {
142
+ schema: type("string[]"),
143
+ arguments: type(["string"]),
144
+ },
145
+ "/event/{event_key}/awards": {
146
+ schema: Award.array(),
147
+ arguments: type(["string"]),
148
+ },
149
+ "/event/{event_key}/team_media": {
150
+ schema: Media.array(),
151
+ arguments: type(["string"]),
152
+ },
153
+ };
@@ -0,0 +1,25 @@
1
+ import { teamEndpoints } from "./teams.js";
2
+ import { statusEndpoints } from "./status.js";
3
+ import { eventEndpoints } from "./events.js";
4
+ import { matchEndpoints } from "./matches.js";
5
+ import { districtEndpoints } from "./districts.js";
6
+ import { regionalAdvancementEndpoints } from "./regionalAdvancements.js";
7
+ import { insightEndpoints } from "./insights.js";
8
+ export declare const searchIndex: {
9
+ "/search_index": {
10
+ schema: import("arktype/internal/methods/object.ts").ObjectType<{
11
+ teams: {
12
+ key: string;
13
+ nickname: string;
14
+ }[];
15
+ events: {
16
+ key: string;
17
+ name: string;
18
+ }[];
19
+ }, {}>;
20
+ arguments: import("arktype/internal/methods/array.ts").ArrayType<[], {}>;
21
+ };
22
+ };
23
+ export declare const endpoints: typeof statusEndpoints & typeof teamEndpoints & typeof eventEndpoints & typeof matchEndpoints & typeof districtEndpoints & typeof regionalAdvancementEndpoints & typeof insightEndpoints & typeof searchIndex;
24
+ export type TBAEndpoints = typeof endpoints;
25
+ export type TBAEndpoint = keyof typeof endpoints;
@@ -0,0 +1,25 @@
1
+ import { teamEndpoints } from "./teams.js";
2
+ import { statusEndpoints } from "./status.js";
3
+ import { eventEndpoints } from "./events.js";
4
+ import { matchEndpoints } from "./matches.js";
5
+ import { districtEndpoints } from "./districts.js";
6
+ import { regionalAdvancementEndpoints } from "./regionalAdvancements.js";
7
+ import { insightEndpoints } from "./insights.js";
8
+ import { type } from "arktype";
9
+ const Search_Index = type({
10
+ teams: type({
11
+ key: "string",
12
+ nickname: "string",
13
+ }).array(),
14
+ events: type({
15
+ key: "string",
16
+ name: "string",
17
+ }).array(),
18
+ });
19
+ export const searchIndex = {
20
+ "/search_index": {
21
+ schema: Search_Index,
22
+ arguments: type([]),
23
+ },
24
+ };
25
+ export const endpoints = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, statusEndpoints), teamEndpoints), eventEndpoints), matchEndpoints), districtEndpoints), regionalAdvancementEndpoints), insightEndpoints), searchIndex);
@@ -0,0 +1,29 @@
1
+ export declare const insightEndpoints: {
2
+ "/insights/leaderboards/{year}": {
3
+ schema: import("arktype/internal/methods/array.ts").ArrayType<{
4
+ data: {
5
+ rankings: {
6
+ value: number;
7
+ keys: string[];
8
+ }[];
9
+ key_type: "event" | "match" | "team";
10
+ };
11
+ name: string;
12
+ year: number;
13
+ }[], {}>;
14
+ arguments: import("arktype/internal/methods/array.ts").ArrayType<[number], {}>;
15
+ };
16
+ "/insights/notables/{year}": {
17
+ schema: import("arktype/internal/methods/array.ts").ArrayType<{
18
+ data: {
19
+ entries: {
20
+ context: string[];
21
+ team_key: string;
22
+ }[];
23
+ };
24
+ name: string;
25
+ year: number;
26
+ }[], {}>;
27
+ arguments: import("arktype/internal/methods/array.ts").ArrayType<[number], {}>;
28
+ };
29
+ };
@@ -0,0 +1,12 @@
1
+ import { LeaderboardInsights, NotablesInsight } from "../schemas/insights.js";
2
+ import { type } from "arktype";
3
+ export const insightEndpoints = {
4
+ "/insights/leaderboards/{year}": {
5
+ schema: LeaderboardInsights.array(),
6
+ arguments: type(["number"]),
7
+ },
8
+ "/insights/notables/{year}": {
9
+ schema: NotablesInsight.array(),
10
+ arguments: type(["number"]),
11
+ },
12
+ };