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,162 @@
1
+ import { Award, Media, Team, Team_Robot, Team_Simple, } from "../schemas/teams.js";
2
+ import { Event, Event_Simple, Team_Event_Status } from "../schemas/events.js";
3
+ import { District_List } from "../schemas/districts.js";
4
+ import { Match, Match_Simple } from "../schemas/matches.js";
5
+ import { type } from "arktype";
6
+ export const teamEndpoints = {
7
+ "/teams/{page_num}": {
8
+ schema: Team.array(),
9
+ arguments: type(["number"]),
10
+ },
11
+ "/teams/{page_num}/simple": {
12
+ schema: Team_Simple.array(),
13
+ arguments: type(["number"]),
14
+ },
15
+ "/teams/{page_num}/keys": {
16
+ schema: type("string[]"),
17
+ arguments: type(["number"]),
18
+ },
19
+ "/teams/{year}/{page_num}": {
20
+ schema: Team.array(),
21
+ arguments: type(["number", "number"]),
22
+ },
23
+ "/teams/{year}/{page_num}/simple": {
24
+ schema: Team_Simple.array(),
25
+ arguments: type(["number", "number"]),
26
+ },
27
+ "/teams/{year}/{page_num}/keys": {
28
+ schema: type("string[]"),
29
+ arguments: type(["number", "number"]),
30
+ },
31
+ "/team/{team_key}": {
32
+ schema: Team,
33
+ arguments: type(["string"]),
34
+ },
35
+ "/team/{team_key}/simple": {
36
+ schema: Team_Simple,
37
+ arguments: type(["string"]),
38
+ },
39
+ "/team/{team_key}/history": {
40
+ schema: type({ events: Event.array(), awards: Award.array() }),
41
+ arguments: type(["string"]),
42
+ },
43
+ "/team/{team_key}/years_participated": {
44
+ schema: type("number[]"),
45
+ arguments: type(["string"]),
46
+ },
47
+ "/team/{team_key}/districts": {
48
+ schema: District_List.array(),
49
+ arguments: type(["string"]),
50
+ },
51
+ "/team/{team_key}/robots": {
52
+ schema: Team_Robot.array(),
53
+ arguments: type(["string"]),
54
+ },
55
+ "/team/{team_key}/events": {
56
+ schema: Event.array(),
57
+ arguments: type(["string"]),
58
+ },
59
+ "/team/{team_key}/events/simple": {
60
+ schema: Event_Simple.array(),
61
+ arguments: type(["string"]),
62
+ },
63
+ "/team/{team_key}/events/keys": {
64
+ schema: type("string[]"),
65
+ arguments: type(["string"]),
66
+ },
67
+ "/team/{team_key}/events/{year}": {
68
+ schema: Event.array(),
69
+ arguments: type(["string", "number"]),
70
+ },
71
+ "/team/{team_key}/events/{year}/simple": {
72
+ schema: Event_Simple.array(),
73
+ arguments: type(["string", "number"]),
74
+ },
75
+ "/team/{team_key}/events/{year}/keys": {
76
+ schema: type("string[]"),
77
+ arguments: type(["string", "number"]),
78
+ },
79
+ "/team/{team_key}/events/{year}/statuses": {
80
+ schema: type({
81
+ "[string]": Team_Event_Status,
82
+ }),
83
+ arguments: type(["string", "number"]),
84
+ },
85
+ "/team/{team_key}/event/{event_key}/matches": {
86
+ schema: Match.array(),
87
+ arguments: type(["string", "string"]),
88
+ transformMatch: ({ key: eventKey }, schema) => {
89
+ if (eventKey &&
90
+ parseInt(eventKey.slice(0, 4)) &&
91
+ Array.isArray(schema) &&
92
+ schema.every((v) => v && typeof v === "object")) {
93
+ for (const member of schema) {
94
+ member["score_breakdown"]["yearOfCompetition"] = parseInt(eventKey.slice(0, 4));
95
+ }
96
+ }
97
+ return schema;
98
+ },
99
+ },
100
+ "/team/{team_key}/event/{event_key}/matches/simple": {
101
+ schema: Match_Simple.array(),
102
+ arguments: type(["string", "string"]),
103
+ },
104
+ "/team/{team_key}/event/{event_key}/matches/keys": {
105
+ schema: type("string[]"),
106
+ arguments: type(["string", "string"]),
107
+ },
108
+ "/team/{team_key}/event/{event_key}/awards": {
109
+ schema: Award.array(),
110
+ arguments: type(["string", "string"]),
111
+ },
112
+ "/team/{team_key}/event/{event_key}/status": {
113
+ schema: type(Team_Event_Status, "|", "null"),
114
+ arguments: type(["string", "string"]),
115
+ },
116
+ "/team/{team_key}/awards": {
117
+ schema: Award.array(),
118
+ arguments: type(["string"]),
119
+ },
120
+ "/team/{team_key}/awards/{year}": {
121
+ schema: Award.array(),
122
+ arguments: type(["string", "number"]),
123
+ },
124
+ "/team/{team_key}/matches/{year}": {
125
+ schema: Match.array(),
126
+ arguments: type(["string", "number"]),
127
+ transformMatch: ({ year }, schema) => {
128
+ if (year &&
129
+ Array.isArray(schema) &&
130
+ schema.every((v) => v && typeof v === "object")) {
131
+ for (const member of schema) {
132
+ member["score_breakdown"]["yearOfCompetition"] = year;
133
+ }
134
+ }
135
+ return schema;
136
+ },
137
+ },
138
+ "/team/{team_key}/matches/{year}/simple": {
139
+ schema: Match_Simple.array(),
140
+ arguments: type(["string", "number"]),
141
+ },
142
+ "/team/{team_key}/matches/{year}/keys": {
143
+ schema: type("string[]"),
144
+ arguments: type(["string", "number"]),
145
+ },
146
+ "/team/{team_key}/media/{year}": {
147
+ schema: Media.array(),
148
+ arguments: type(["string", "number"]),
149
+ },
150
+ "/team/{team_key}/media/tag/{media_tag}": {
151
+ schema: Media.array(),
152
+ arguments: type(["string", "string"]),
153
+ },
154
+ "/team/{team_key}/media/tag/{media_tag}/{year}": {
155
+ schema: Media.array(),
156
+ arguments: type(["string", "string", "number"]),
157
+ },
158
+ "/team/{team_key}/social_media": {
159
+ schema: Media.array(),
160
+ arguments: type(["string"]),
161
+ },
162
+ };
@@ -0,0 +1,11 @@
1
+ import { Type } from "arktype";
2
+ export type Endpoints = {
3
+ [key: string]: {
4
+ schema: Type;
5
+ arguments: Type<[...unknown[]]>;
6
+ transformMatch?: (data: {
7
+ year?: number;
8
+ key?: string;
9
+ }, schema: unknown) => unknown;
10
+ };
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ export declare const District_List: import("arktype/internal/methods/object.ts").ObjectType<{
2
+ abbreviation: string;
3
+ display_name: string;
4
+ key: string;
5
+ year: number;
6
+ }, {}>;
7
+ export declare const District_Ranking: import("arktype/internal/methods/object.ts").ObjectType<{
8
+ team_key: string;
9
+ rank: number;
10
+ point_total: number;
11
+ rookie_bonus?: number | undefined;
12
+ event_point?: {
13
+ district_cmp: boolean;
14
+ total: number;
15
+ alliance_points: number;
16
+ elim_points: number;
17
+ award_points: number;
18
+ event_key: string;
19
+ qual_points: number;
20
+ }[] | undefined;
21
+ }, {}>;
22
+ export declare const District_Advancement: import("arktype/internal/methods/object.ts").ObjectType<{
23
+ dcmp: boolean;
24
+ cmp: boolean;
25
+ }, {}>;
@@ -0,0 +1,28 @@
1
+ import { type } from "arktype";
2
+ export const District_List = type({
3
+ abbreviation: "string",
4
+ display_name: "string",
5
+ key: "string",
6
+ year: "number",
7
+ });
8
+ export const District_Ranking = type({
9
+ team_key: "string",
10
+ rank: "number",
11
+ rookie_bonus: "number?",
12
+ point_total: "number",
13
+ event_point: type({
14
+ district_cmp: "boolean",
15
+ total: "number",
16
+ alliance_points: "number",
17
+ elim_points: "number",
18
+ award_points: "number",
19
+ event_key: "string",
20
+ qual_points: "number",
21
+ })
22
+ .array()
23
+ .optional(),
24
+ });
25
+ export const District_Advancement = type({
26
+ dcmp: "boolean",
27
+ cmp: "boolean",
28
+ });
@@ -0,0 +1,186 @@
1
+ export declare const Webcast: import("arktype/internal/methods/object.ts").ObjectType<{
2
+ type: "youtube" | "twitch" | "ustream" | "iframe" | "html5" | "rtmp" | "livestream" | "direct_link" | "mms" | "justin" | "stemtv" | "dacast";
3
+ channel: string;
4
+ date?: string | null | undefined;
5
+ file?: string | null | undefined;
6
+ }, {}>;
7
+ export declare const Event_Simple: import("arktype/internal/methods/object.ts").ObjectType<{
8
+ key: string;
9
+ name: string;
10
+ event_code: string;
11
+ event_type: number;
12
+ district: {
13
+ abbreviation: string;
14
+ display_name: string;
15
+ key: string;
16
+ year: number;
17
+ } | null;
18
+ city: string | null;
19
+ state_prov: string | null;
20
+ country: string | null;
21
+ start_date: string;
22
+ end_date: string;
23
+ year: number;
24
+ }, {}>;
25
+ export declare const Event: import("arktype/internal/methods/object.ts").ObjectType<{
26
+ key: string;
27
+ name: string;
28
+ event_code: string;
29
+ event_type: number;
30
+ district: {
31
+ abbreviation: string;
32
+ display_name: string;
33
+ key: string;
34
+ year: number;
35
+ } | null;
36
+ city: string | null;
37
+ state_prov: string | null;
38
+ country: string | null;
39
+ start_date: string;
40
+ end_date: string;
41
+ year: number;
42
+ short_name: string | null;
43
+ event_type_string: string;
44
+ week: number | null;
45
+ address: string | null;
46
+ postal_code: string | null;
47
+ gmaps_place_id: string | null;
48
+ gmaps_url: string | null;
49
+ lat: number | null;
50
+ lng: number | null;
51
+ location_name: string | null;
52
+ timezone: string | null;
53
+ website: string | null;
54
+ first_event_id: string | null;
55
+ first_event_code: string | null;
56
+ webcasts: {
57
+ type: "youtube" | "twitch" | "ustream" | "iframe" | "html5" | "rtmp" | "livestream" | "direct_link" | "mms" | "justin" | "stemtv" | "dacast";
58
+ channel: string;
59
+ date?: string | null | undefined;
60
+ file?: string | null | undefined;
61
+ }[];
62
+ division_keys: string[];
63
+ parent_event_key: string | null;
64
+ playoff_type: number | null;
65
+ playoff_type_string: string | null;
66
+ }, {}>;
67
+ export declare const WLT_Record: import("arktype/internal/methods/object.ts").ObjectType<{
68
+ wins: number;
69
+ losses: number;
70
+ ties: number;
71
+ }, {}>;
72
+ export declare const Team_Event_Status_rank: import("arktype/internal/methods/object.ts").ObjectType<{
73
+ num_teams?: number | null | undefined;
74
+ sort_order_info?: ({
75
+ precision: number | null;
76
+ name: string | null;
77
+ } | null)[] | undefined;
78
+ status?: string | null | undefined;
79
+ ranking?: {
80
+ matches_played: number | null;
81
+ qual_average: number | null;
82
+ sort_orders: number[] | null;
83
+ rank: number | null;
84
+ dq: number | null;
85
+ team_key: string | null;
86
+ } | undefined;
87
+ }, {}>;
88
+ export declare const Team_Event_Status_alliance_backup: import("arktype/internal/methods/object.ts").ObjectType<{
89
+ in?: string | undefined;
90
+ out?: string | undefined;
91
+ }, {}>;
92
+ export declare const Team_Event_Status_alliance: import("arktype/internal/methods/object.ts").ObjectType<{
93
+ number: number;
94
+ pick: number;
95
+ name?: string | null | undefined;
96
+ backup?: {
97
+ in?: string | undefined;
98
+ out?: string | undefined;
99
+ } | null | undefined;
100
+ }, {}>;
101
+ export declare const Team_Event_Status_playoff: import("arktype/internal/methods/object.ts").ObjectType<{
102
+ level?: "f" | "qm" | "ef" | "qf" | "sf" | undefined;
103
+ current_level_record?: {
104
+ wins: number;
105
+ losses: number;
106
+ ties: number;
107
+ } | null | undefined;
108
+ record?: {
109
+ wins: number;
110
+ losses: number;
111
+ ties: number;
112
+ } | null | undefined;
113
+ status?: "won" | "eliminated" | "playing" | undefined;
114
+ playoff_average?: number | null | undefined;
115
+ }, {}>;
116
+ export declare const Team_Event_Status: import("arktype/internal/methods/object.ts").ObjectType<{
117
+ alliance_status_str?: string | undefined;
118
+ playoff_status_str?: string | undefined;
119
+ overall_status_str?: string | undefined;
120
+ next_match_key?: string | null | undefined;
121
+ last_match_key?: string | null | undefined;
122
+ playoff?: {
123
+ level?: "f" | "qm" | "ef" | "qf" | "sf" | undefined;
124
+ current_level_record?: {
125
+ wins: number;
126
+ losses: number;
127
+ ties: number;
128
+ } | null | undefined;
129
+ record?: {
130
+ wins: number;
131
+ losses: number;
132
+ ties: number;
133
+ } | null | undefined;
134
+ status?: "won" | "eliminated" | "playing" | undefined;
135
+ playoff_average?: number | null | undefined;
136
+ } | null | undefined;
137
+ qual?: {
138
+ num_teams?: number | null | undefined;
139
+ sort_order_info?: ({
140
+ precision: number | null;
141
+ name: string | null;
142
+ } | null)[] | undefined;
143
+ status?: string | null | undefined;
144
+ ranking?: {
145
+ matches_played: number | null;
146
+ qual_average: number | null;
147
+ sort_orders: number[] | null;
148
+ rank: number | null;
149
+ dq: number | null;
150
+ team_key: string | null;
151
+ } | undefined;
152
+ } | null | undefined;
153
+ alliance?: {
154
+ number: number;
155
+ pick: number;
156
+ name?: string | null | undefined;
157
+ backup?: {
158
+ in?: string | undefined;
159
+ out?: string | undefined;
160
+ } | null | undefined;
161
+ } | null | undefined;
162
+ }, {}>;
163
+ export declare const Elimination_Alliance: import("arktype/internal/methods/object.ts").ObjectType<{
164
+ declines: string[];
165
+ picks: string[];
166
+ name?: string | null | undefined;
167
+ backup?: {
168
+ in: string;
169
+ out: string;
170
+ } | null | undefined;
171
+ status?: {
172
+ playoff_average?: number | null | undefined;
173
+ level?: string | undefined;
174
+ record?: {
175
+ wins: number;
176
+ losses: number;
177
+ ties: number;
178
+ } | null | undefined;
179
+ current_level_record?: {
180
+ wins: number;
181
+ losses: number;
182
+ ties: number;
183
+ } | null | undefined;
184
+ status?: string | undefined;
185
+ } | undefined;
186
+ }, {}>;
@@ -0,0 +1,109 @@
1
+ import { District_List } from "./districts.js";
2
+ import { type } from "arktype";
3
+ export const Webcast = type({
4
+ type: "'youtube' | 'twitch' | 'ustream' | 'iframe' | 'html5' | 'rtmp' | 'livestream' | 'direct_link' | 'mms' | 'justin' | 'stemtv' | 'dacast'",
5
+ channel: "string",
6
+ "date?": "string | null",
7
+ file: "(string | null)?",
8
+ });
9
+ export const Event_Simple = type({
10
+ key: "string",
11
+ name: "string",
12
+ event_code: "string",
13
+ event_type: "number",
14
+ district: type(District_List, "|", "null"),
15
+ city: "string | null",
16
+ state_prov: "string | null",
17
+ country: "string | null",
18
+ start_date: "string",
19
+ end_date: "string",
20
+ year: "number",
21
+ });
22
+ export const Event = Event_Simple.and({
23
+ short_name: "string | null",
24
+ event_type_string: "string",
25
+ week: "number | null",
26
+ address: "string | null",
27
+ postal_code: "string | null",
28
+ gmaps_place_id: "string | null",
29
+ gmaps_url: "string | null",
30
+ lat: "number | null",
31
+ lng: "number | null",
32
+ location_name: "string | null",
33
+ timezone: "string | null",
34
+ website: "string | null",
35
+ first_event_id: "string | null",
36
+ first_event_code: "string | null",
37
+ webcasts: Webcast.array(),
38
+ division_keys: "string[]",
39
+ parent_event_key: "string | null",
40
+ playoff_type: "number | null",
41
+ playoff_type_string: "string | null",
42
+ });
43
+ export const WLT_Record = type({
44
+ wins: "number",
45
+ losses: "number",
46
+ ties: "number",
47
+ });
48
+ // Docs don't say it is nullable, but it has been null during testing
49
+ export const Team_Event_Status_rank = type({
50
+ num_teams: "number | null",
51
+ ranking: type({
52
+ matches_played: "number | null",
53
+ qual_average: "number | null",
54
+ sort_orders: "number[] | null",
55
+ rank: "number | null",
56
+ dq: "number | null",
57
+ team_key: "string | null",
58
+ }).optional(),
59
+ sort_order_info: type({
60
+ precision: "number | null",
61
+ name: "string | null",
62
+ }, "|", "null").array(),
63
+ status: "string | null",
64
+ }).partial();
65
+ export const Team_Event_Status_alliance_backup = type({
66
+ in: "string?",
67
+ out: "string?",
68
+ });
69
+ export const Team_Event_Status_alliance = type({
70
+ name: "(string | null)?",
71
+ number: "number",
72
+ backup: type(Team_Event_Status_alliance_backup, "|", "null").optional(),
73
+ pick: "number",
74
+ });
75
+ export const Team_Event_Status_playoff = type({
76
+ "level?": "'qm' | 'ef' | 'qf' | 'sf' | 'f'",
77
+ current_level_record: type(WLT_Record, "|", "null").optional(),
78
+ record: type(WLT_Record, "|", "null").optional(),
79
+ "status?": "'won' | 'eliminated' | 'playing'",
80
+ "playoff_average?": "number | null",
81
+ });
82
+ export const Team_Event_Status = type({
83
+ alliance_status_str: "string?",
84
+ playoff_status_str: "string?",
85
+ overall_status_str: "string?",
86
+ next_match_key: "(string | null)?",
87
+ last_match_key: "(string | null)?",
88
+ playoff: type(Team_Event_Status_playoff, "|", "null").optional(),
89
+ qual: type(Team_Event_Status_rank, "|", "null").optional(),
90
+ alliance: type(Team_Event_Status_alliance, "|", "null").optional(),
91
+ });
92
+ export const Elimination_Alliance = type({
93
+ name: "(string | null)?",
94
+ backup: type({
95
+ in: "string",
96
+ out: "string",
97
+ }, "|", "null").optional(),
98
+ declines: "string[]",
99
+ picks: "string[]",
100
+ status: type({
101
+ playoff_average: "number | null",
102
+ level: "string",
103
+ record: type(WLT_Record, "|", "null"),
104
+ current_level_record: type(WLT_Record, "|", "null"),
105
+ status: "string",
106
+ })
107
+ .partial()
108
+ .optional(),
109
+ });
@@ -0,0 +1,21 @@
1
+ export declare const LeaderboardInsights: import("arktype/internal/methods/object.ts").ObjectType<{
2
+ data: {
3
+ rankings: {
4
+ value: number;
5
+ keys: string[];
6
+ }[];
7
+ key_type: "event" | "match" | "team";
8
+ };
9
+ name: string;
10
+ year: number;
11
+ }, {}>;
12
+ export declare const NotablesInsight: import("arktype/internal/methods/object.ts").ObjectType<{
13
+ data: {
14
+ entries: {
15
+ context: string[];
16
+ team_key: string;
17
+ }[];
18
+ };
19
+ name: string;
20
+ year: number;
21
+ }, {}>;
@@ -0,0 +1,22 @@
1
+ import { type } from "arktype";
2
+ export const LeaderboardInsights = type({
3
+ data: {
4
+ rankings: type({
5
+ value: "number",
6
+ keys: "string[]",
7
+ }).array(),
8
+ key_type: "'team' | 'event' | 'match'",
9
+ },
10
+ name: "string",
11
+ year: "number",
12
+ });
13
+ export const NotablesInsight = type({
14
+ data: {
15
+ entries: type({
16
+ context: "string[]",
17
+ team_key: "string",
18
+ }).array(),
19
+ },
20
+ name: "string",
21
+ year: "number",
22
+ });