tbarequest 1.0.0 → 1.0.2

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/dist/index.js ADDED
@@ -0,0 +1,1380 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+
18
+ // src/utils.ts
19
+ async function tryCatch(promise) {
20
+ try {
21
+ const data = await promise;
22
+ return { data, error: null };
23
+ } catch (error) {
24
+ return { data: null, error };
25
+ }
26
+ }
27
+
28
+ // src/types/schemas/teams.ts
29
+ import { type } from "arktype";
30
+ var Team_Simple = type({
31
+ key: "string",
32
+ team_number: "number",
33
+ nickname: "string",
34
+ name: "string",
35
+ city: "string | null",
36
+ state_prov: "string | null",
37
+ country: "string | null"
38
+ });
39
+ var Team = Team_Simple.and({
40
+ postal_code: "string | null",
41
+ "website?": "string | null",
42
+ rookie_year: "number | null"
43
+ });
44
+ var Award_Recipient = type({
45
+ team_key: "string | null",
46
+ awardee: "string | null"
47
+ });
48
+ var Award = type({
49
+ name: "string",
50
+ award_type: "number",
51
+ event_key: "string",
52
+ recipient_list: Award_Recipient.array(),
53
+ year: "number"
54
+ });
55
+ var Team_Robot = type({
56
+ year: "number",
57
+ robot_name: "string",
58
+ key: "string",
59
+ team_key: "string"
60
+ });
61
+ var Media = type({
62
+ type: "string",
63
+ foreign_key: "string",
64
+ "details?": type({ "[string]": "unknown" }),
65
+ preferred: "boolean?",
66
+ team_keys: "string[]",
67
+ direct_url: "string?",
68
+ view_url: "string?"
69
+ });
70
+
71
+ // src/types/schemas/districts.ts
72
+ import { type as type2 } from "arktype";
73
+ var District_List = type2({
74
+ abbreviation: "string",
75
+ display_name: "string",
76
+ key: "string",
77
+ year: "number"
78
+ });
79
+ var District_Ranking = type2({
80
+ team_key: "string",
81
+ rank: "number",
82
+ rookie_bonus: "number?",
83
+ point_total: "number",
84
+ event_point: type2({
85
+ district_cmp: "boolean",
86
+ total: "number",
87
+ alliance_points: "number",
88
+ elim_points: "number",
89
+ award_points: "number",
90
+ event_key: "string",
91
+ qual_points: "number"
92
+ }).array().optional()
93
+ });
94
+ var District_Advancement = type2({
95
+ dcmp: "boolean",
96
+ cmp: "boolean"
97
+ });
98
+
99
+ // src/types/schemas/events.ts
100
+ import { type as type3 } from "arktype";
101
+ var Webcast = type3({
102
+ type: "'youtube' | 'twitch' | 'ustream' | 'iframe' | 'html5' | 'rtmp' | 'livestream' | 'direct_link' | 'mms' | 'justin' | 'stemtv' | 'dacast'",
103
+ channel: "string",
104
+ "date?": "string | null",
105
+ file: "(string | null)?"
106
+ });
107
+ var Event_Simple = type3({
108
+ key: "string",
109
+ name: "string",
110
+ event_code: "string",
111
+ event_type: "number",
112
+ district: type3(District_List, "|", "null"),
113
+ city: "string | null",
114
+ state_prov: "string | null",
115
+ country: "string | null",
116
+ start_date: "string",
117
+ end_date: "string",
118
+ year: "number"
119
+ });
120
+ var Event = Event_Simple.and({
121
+ short_name: "string | null",
122
+ event_type_string: "string",
123
+ week: "number | null",
124
+ address: "string | null",
125
+ postal_code: "string | null",
126
+ gmaps_place_id: "string | null",
127
+ gmaps_url: "string | null",
128
+ lat: "number | null",
129
+ lng: "number | null",
130
+ location_name: "string | null",
131
+ timezone: "string | null",
132
+ website: "string | null",
133
+ first_event_id: "string | null",
134
+ first_event_code: "string | null",
135
+ webcasts: Webcast.array(),
136
+ division_keys: "string[]",
137
+ parent_event_key: "string | null",
138
+ playoff_type: "number | null",
139
+ playoff_type_string: "string | null"
140
+ });
141
+ var WLT_Record = type3({
142
+ wins: "number",
143
+ losses: "number",
144
+ ties: "number"
145
+ });
146
+ var Team_Event_Status_rank = type3({
147
+ num_teams: "number | null",
148
+ ranking: type3({
149
+ matches_played: "number | null",
150
+ qual_average: "number | null",
151
+ sort_orders: "number[] | null",
152
+ rank: "number | null",
153
+ dq: "number | null",
154
+ team_key: "string | null"
155
+ }).optional(),
156
+ sort_order_info: type3(
157
+ {
158
+ precision: "number | null",
159
+ name: "string | null"
160
+ },
161
+ "|",
162
+ "null"
163
+ ).array(),
164
+ status: "string | null"
165
+ }).partial();
166
+ var Team_Event_Status_alliance_backup = type3({
167
+ in: "string?",
168
+ out: "string?"
169
+ });
170
+ var Team_Event_Status_alliance = type3({
171
+ name: "(string | null)?",
172
+ number: "number",
173
+ backup: type3(Team_Event_Status_alliance_backup, "|", "null").optional(),
174
+ pick: "number"
175
+ });
176
+ var Team_Event_Status_playoff = type3({
177
+ "level?": "'qm' | 'ef' | 'qf' | 'sf' | 'f'",
178
+ current_level_record: type3(WLT_Record, "|", "null").optional(),
179
+ record: type3(WLT_Record, "|", "null").optional(),
180
+ "status?": "'won' | 'eliminated' | 'playing'",
181
+ "playoff_average?": "number | null"
182
+ });
183
+ var Team_Event_Status = type3({
184
+ alliance_status_str: "string?",
185
+ playoff_status_str: "string?",
186
+ overall_status_str: "string?",
187
+ next_match_key: "(string | null)?",
188
+ last_match_key: "(string | null)?",
189
+ playoff: type3(Team_Event_Status_playoff, "|", "null").optional(),
190
+ qual: type3(Team_Event_Status_rank, "|", "null").optional(),
191
+ alliance: type3(Team_Event_Status_alliance, "|", "null").optional()
192
+ });
193
+ var Elimination_Alliance = type3({
194
+ name: "(string | null)?",
195
+ backup: type3(
196
+ {
197
+ in: "string",
198
+ out: "string"
199
+ },
200
+ "|",
201
+ "null"
202
+ ).optional(),
203
+ declines: "string[]",
204
+ picks: "string[]",
205
+ status: type3({
206
+ playoff_average: "number | null",
207
+ level: "string",
208
+ record: type3(WLT_Record, "|", "null"),
209
+ current_level_record: type3(WLT_Record, "|", "null"),
210
+ status: "string"
211
+ }).partial().optional()
212
+ });
213
+
214
+ // src/types/schemas/matches.ts
215
+ import { type as type4 } from "arktype";
216
+ var reef = type4({
217
+ botRow: {
218
+ nodeA: "boolean",
219
+ nodeB: "boolean",
220
+ nodeC: "boolean",
221
+ nodeD: "boolean",
222
+ nodeE: "boolean",
223
+ nodeF: "boolean",
224
+ nodeG: "boolean",
225
+ nodeH: "boolean",
226
+ nodeI: "boolean",
227
+ nodeJ: "boolean",
228
+ nodeK: "boolean",
229
+ nodeL: "boolean"
230
+ },
231
+ midRow: {
232
+ nodeA: "boolean",
233
+ nodeB: "boolean",
234
+ nodeC: "boolean",
235
+ nodeD: "boolean",
236
+ nodeE: "boolean",
237
+ nodeF: "boolean",
238
+ nodeG: "boolean",
239
+ nodeH: "boolean",
240
+ nodeI: "boolean",
241
+ nodeJ: "boolean",
242
+ nodeK: "boolean",
243
+ nodeL: "boolean"
244
+ },
245
+ topRow: {
246
+ nodeA: "boolean",
247
+ nodeB: "boolean",
248
+ nodeC: "boolean",
249
+ nodeD: "boolean",
250
+ nodeE: "boolean",
251
+ nodeF: "boolean",
252
+ nodeG: "boolean",
253
+ nodeH: "boolean",
254
+ nodeI: "boolean",
255
+ nodeJ: "boolean",
256
+ nodeK: "boolean",
257
+ nodeL: "boolean"
258
+ },
259
+ trough: "number",
260
+ tba_botRowCount: "number",
261
+ tba_midRowCount: "number",
262
+ tba_topRowCount: "number"
263
+ });
264
+ var matchScoreBreakdownYearsAlliances = {
265
+ "2015": type4({
266
+ adjust_points: "number",
267
+ auto_points: "number",
268
+ container_count_level1: "number",
269
+ container_count_level2: "number",
270
+ container_count_level3: "number",
271
+ container_count_level4: "number",
272
+ container_count_level5: "number",
273
+ container_count_level6: "number",
274
+ container_points: "number",
275
+ container_set: "boolean",
276
+ foul_count: "number",
277
+ foul_points: "number",
278
+ litter_count_container: "number",
279
+ litter_count_landfill: "number",
280
+ litter_count_unprocessed: "number",
281
+ litter_points: "number",
282
+ robot_set: "boolean",
283
+ teleop_points: "number",
284
+ total_points: "number",
285
+ tote_count_far: "number",
286
+ tote_count_near: "number",
287
+ tote_points: "number",
288
+ tote_set: "boolean",
289
+ tote_stack: "boolean"
290
+ }).partial(),
291
+ "2016": type4({
292
+ adjustPoints: "number",
293
+ autoBoulderPoints: "number",
294
+ autoBouldersHigh: "number",
295
+ autoBouldersLow: "number",
296
+ autoCrossingPoints: "number",
297
+ autoPoints: "number",
298
+ autoReachPoints: "number",
299
+ breachPoints: "number",
300
+ capturePoints: "number",
301
+ foulCount: "number",
302
+ foulPoints: "number",
303
+ position1crossings: "number",
304
+ position2: "string",
305
+ position2crossings: "number",
306
+ position3: "string",
307
+ position3crossings: "number",
308
+ position4: "string",
309
+ position4crossings: "number",
310
+ position5: "string",
311
+ position5crossings: "number",
312
+ robot1Auto: "'Crossed' | 'Reached' | 'None'",
313
+ robot2Auto: "string",
314
+ robot3Auto: "string",
315
+ tba_rpEarned: "number",
316
+ techFoulCount: "number",
317
+ teleopBoulderPoints: "number",
318
+ teleopBouldersHigh: "number",
319
+ teleopBouldersLow: "number",
320
+ teleopChallengePoints: "number",
321
+ teleopCrossingPoints: "number",
322
+ teleopDefensesBreached: "boolean",
323
+ teleopPoints: "number",
324
+ teleopScalePoints: "number",
325
+ teleopTowerCaptured: "boolean",
326
+ totalPoints: "number",
327
+ towerEndStrength: "number",
328
+ towerFaceA: "string",
329
+ towerFaceB: "string",
330
+ towerFaceC: "string"
331
+ }).partial(),
332
+ "2017": type4({
333
+ adjustPoints: "number",
334
+ autoFuelHigh: "number",
335
+ autoFuelLow: "number",
336
+ autoFuelPoints: "number",
337
+ autoMobilityPoints: "number",
338
+ autoPoints: "number",
339
+ autoRotorPoints: "number",
340
+ foulCount: "number",
341
+ foulPoints: "number",
342
+ kPaBonusPoints: "number",
343
+ kPaRankingPointAchieved: "boolean",
344
+ robot1Auto: "'Unknown' | 'Mobility' | 'None'",
345
+ robot2Auto: "'Unknown' | 'Mobility' | 'None'",
346
+ robot3Auto: "'Unknown' | 'Mobility' | 'None'",
347
+ rotor1Auto: "boolean",
348
+ rotor1Engaged: "boolean",
349
+ rotor2Auto: "boolean",
350
+ rotor2Engaged: "boolean",
351
+ rotor3Engaged: "boolean",
352
+ rotor4Engaged: "boolean",
353
+ rotorBonusPoints: "number",
354
+ rotorRankingPointAchieved: "boolean",
355
+ tba_rpEarned: "number",
356
+ techFoulCount: "number",
357
+ teleopFuelHigh: "number",
358
+ teleopFuelLow: "number",
359
+ teleopFuelPoints: "number",
360
+ teleopPoints: "number",
361
+ teleopRotorPoints: "number",
362
+ teleopTakeoffPoints: "number",
363
+ totalPoints: "number",
364
+ touchpadFar: "string",
365
+ touchpadMiddle: "string",
366
+ touchpadNear: "string"
367
+ }).partial(),
368
+ "2018": type4({
369
+ adjustPoints: "number",
370
+ autoOwnershipPoints: "number",
371
+ autoPoints: "number",
372
+ autoQuestRankingPoint: "boolean",
373
+ autoRobot1: "string",
374
+ autoRobot2: "string",
375
+ autoRobot3: "string",
376
+ autoRunPoints: "number",
377
+ autoScaleOwnershipSec: "number",
378
+ autoSwitchAtZero: "boolean",
379
+ autoSwitchOwnershipSec: "number",
380
+ endgamePoints: "number",
381
+ endgameRobot1: "string",
382
+ endgameRobot2: "string",
383
+ endgameRobot3: "string",
384
+ faceTheBossRankingPoint: "boolean",
385
+ foulCount: "number",
386
+ foulPoints: "number",
387
+ rp: "number",
388
+ tba_gameData: "string",
389
+ techFoulCount: "number",
390
+ teleopOwnershipPoints: "number",
391
+ teleopPoints: "number",
392
+ teleopScaleBoostSec: "number",
393
+ teleopScaleForceSec: "number",
394
+ teleopScaleOwnershipSec: "number",
395
+ teleopSwitchBoostSec: "number",
396
+ teleopSwitchForceSec: "number",
397
+ teleopSwitchOwnershipSec: "number",
398
+ totalPoints: "number",
399
+ vaultBoostPlayed: "number",
400
+ vaultBoostTotal: "number",
401
+ vaultForcePlayed: "number",
402
+ vaultForceTotal: "number",
403
+ vaultLevitatePlayed: "number",
404
+ vaultLevitateTotal: "number",
405
+ vaultPoints: "number"
406
+ }).partial(),
407
+ "2019": type4({
408
+ adjustPoints: "number",
409
+ autoPoints: "number",
410
+ bay1: "string",
411
+ bay2: "string",
412
+ bay3: "string",
413
+ bay4: "string",
414
+ bay5: "string",
415
+ bay6: "string",
416
+ bay7: "string",
417
+ bay8: "string",
418
+ cargoPoints: "number",
419
+ completeRocketRankingPoint: "boolean",
420
+ completedRocketFar: "boolean",
421
+ completedRocketNear: "boolean",
422
+ endgameRobot1: "string",
423
+ endgameRobot2: "string",
424
+ endgameRobot3: "string",
425
+ foulCount: "number",
426
+ foulPoints: "number",
427
+ habClimbPoints: "number",
428
+ habDockingRankingPoint: "boolean",
429
+ habLineRobot1: "string",
430
+ habLineRobot2: "string",
431
+ habLineRobot3: "string",
432
+ hatchPanelPoints: "number",
433
+ lowLeftRocketFar: "string",
434
+ lowLeftRocketNear: "string",
435
+ lowRightRocketFar: "string",
436
+ lowRightRocketNear: "string",
437
+ midLeftRocketFar: "string",
438
+ midLeftRocketNear: "string",
439
+ midRightRocketFar: "string",
440
+ midRightRocketNear: "string",
441
+ preMatchBay1: "string",
442
+ preMatchBay2: "string",
443
+ preMatchBay3: "string",
444
+ preMatchBay6: "string",
445
+ preMatchBay7: "string",
446
+ preMatchBay8: "string",
447
+ preMatchLevelRobot1: "string",
448
+ preMatchLevelRobot2: "string",
449
+ preMatchLevelRobot3: "string",
450
+ rp: "number",
451
+ sandStormBonusPoints: "number",
452
+ techFoulCount: "number",
453
+ teleopPoints: "number",
454
+ topLeftRocketFar: "string",
455
+ topLeftRocketNear: "string",
456
+ topRightRocketFar: "string",
457
+ topRightRocketNear: "string",
458
+ totalPoints: "number"
459
+ }).partial(),
460
+ "2020": type4({
461
+ adjustPoints: "number",
462
+ autoCellPoints: "number",
463
+ autoCellsBottom: "number",
464
+ autoCellsInner: "number",
465
+ autoCellsOuter: "number",
466
+ autoInitLinePoints: "number",
467
+ autoPoints: "number",
468
+ controlPanelPoints: "number",
469
+ endgamePoints: "number",
470
+ endgameRobot1: "string",
471
+ endgameRobot2: "string",
472
+ endgameRobot3: "string",
473
+ endgameRungIsLevel: "string",
474
+ foulCount: "number",
475
+ foulPoints: "number",
476
+ initLineRobot1: "string",
477
+ initLineRobot2: "string",
478
+ initLineRobot3: "string",
479
+ rp: "number",
480
+ shieldEnergizedRankingPoint: "boolean",
481
+ shieldOperationalRankingPoint: "boolean",
482
+ stage1Activated: "boolean",
483
+ stage2Activated: "boolean",
484
+ stage3Activated: "boolean",
485
+ stage3TargetColor: "string",
486
+ tba_numRobotsHanging: "number",
487
+ tba_shieldEnergizedRankingPointFromFoul: "boolean",
488
+ techFoulCount: "number",
489
+ teleopCellPoints: "number",
490
+ teleopCellsBottom: "number",
491
+ teleopCellsInner: "number",
492
+ teleopCellsOuter: "number",
493
+ teleopPoints: "number",
494
+ totalPoints: "number"
495
+ }).partial(),
496
+ "2022": type4({
497
+ adjustPoints: "number",
498
+ autoCargoLowerBlue: "number",
499
+ autoCargoLowerFar: "number",
500
+ autoCargoLowerNear: "number",
501
+ autoCargoLowerRed: "number",
502
+ autoCargoPoints: "number",
503
+ autoCargoTotal: "number",
504
+ autoCargoUpperBlue: "number",
505
+ autoCargoUpperFar: "number",
506
+ autoCargoUpperNear: "number",
507
+ autoCargoUpperRed: "number",
508
+ autoPoints: "number",
509
+ autoTaxiPoints: "number",
510
+ cargoBonusRankingPoint: "boolean",
511
+ endgamePoints: "number",
512
+ endgameRobot1: "'Transversal' | 'High' | 'Mid' | 'Low' | 'None'",
513
+ endgameRobot2: "'Transversal' | 'High' | 'Mid' | 'Low' | 'None'",
514
+ endgameRobot3: "'Transversal' | 'High' | 'Mid' | 'Low' | 'None'",
515
+ foulCount: "number",
516
+ foulPoints: "number",
517
+ hangarBonusRankingPoint: "boolean",
518
+ matchCargoTotal: "number",
519
+ quintetAchieved: "boolean",
520
+ rp: "number",
521
+ taxiRobot1: "'Yes' | 'No'",
522
+ taxiRobot2: "'Yes' | 'No'",
523
+ taxiRobot3: "'Yes' | 'No'",
524
+ techFoulCount: "number",
525
+ teleopCargoLowerBlue: "number",
526
+ teleopCargoLowerFar: "number",
527
+ teleopCargoLowerNear: "number",
528
+ teleopCargoLowerRed: "number",
529
+ teleopCargoPoints: "number",
530
+ teleopCargoTotal: "number",
531
+ teleopCargoUpperBlue: "number",
532
+ teleopCargoUpperFar: "number",
533
+ teleopCargoUpperNear: "number",
534
+ teleopCargoUpperRed: "number",
535
+ teleopPoints: "number",
536
+ totalPoints: "number"
537
+ }).partial(),
538
+ "2023": type4({
539
+ activationBonusAchieved: "boolean",
540
+ adjustPoints: "number",
541
+ autoBridgeState: "'NotLevel' | 'Level'",
542
+ autoChargeStationPoints: "number",
543
+ autoChargeStationRobot1: "'None' | 'Docked'",
544
+ autoChargeStationRobot2: "'None' | 'Docked'",
545
+ autoChargeStationRobot3: "'None' | 'Docked'",
546
+ autoCommunity: {
547
+ B: "('None' | 'Cube' | 'Cone')[]",
548
+ M: "('None' | 'Cube' | 'Cone')[]",
549
+ T: "('None' | 'Cube' | 'Cone')[]"
550
+ },
551
+ autoDocked: "boolean",
552
+ autoGamePieceCount: "number",
553
+ autoGamePiecePoints: "number",
554
+ autoMobilityPoints: "number",
555
+ autoPoints: "number",
556
+ coopGamePieceCount: "number",
557
+ coopertitionCriteriaMet: "boolean",
558
+ endGameBridgeState: "'NotLevel' | 'Level'",
559
+ endGameChargeStationPoints: "number",
560
+ endGameChargeStationRobot1: "'None' | 'Docked' | 'Parked'",
561
+ endGameChargeStationRobot2: "'None' | 'Docked' | 'Parked'",
562
+ endGameChargeStationRobot3: "'None' | 'Docked' | 'Parked'",
563
+ endGameParkPoints: "number",
564
+ foulCount: "number",
565
+ foulPoints: "number",
566
+ linkPoints: "number",
567
+ links: type4({
568
+ nodes: "number[]",
569
+ row: "'Bottom' | 'Mid' | 'Top'"
570
+ }).array(),
571
+ mobilityRobot1: "'Yes' | 'No'",
572
+ mobilityRobot2: "'Yes' | 'No'",
573
+ mobilityRobot3: "'Yes' | 'No'",
574
+ rp: "number",
575
+ sustainabilityBonusAchieved: "boolean",
576
+ techFoulCount: "number",
577
+ teleopCommunity: {
578
+ B: "('None' | 'Cube' | 'Cone')[]",
579
+ M: "('None' | 'Cube' | 'Cone')[]",
580
+ T: "('None' | 'Cube' | 'Cone')[]"
581
+ },
582
+ teleopGamePieceCount: "number",
583
+ teleopGamePiecePoints: "number",
584
+ teleopPoints: "number",
585
+ totalChargeStationPoints: "number",
586
+ totalPoints: "number"
587
+ }).partial(),
588
+ "2024": type4({
589
+ adjustPoints: "number",
590
+ autoAmpNoteCount: "number",
591
+ autoAmpNotePoints: "number",
592
+ autoLeavePoints: "number",
593
+ autoLineRobot1: "string",
594
+ autoLineRobot2: "string",
595
+ autoLineRobot3: "string",
596
+ autoPoints: "number",
597
+ autoSpeakerNoteCount: "number",
598
+ autoSpeakerNotePoints: "number",
599
+ autoTotalNotePoints: "number",
600
+ coopNotePlayed: "boolean",
601
+ coopertitionBonusAchieved: "boolean",
602
+ coopertitionCriteriaMet: "boolean",
603
+ endGameHarmonyPoints: "number",
604
+ endGameNoteInTrapPoints: "number",
605
+ endGameOnStagePoints: "number",
606
+ endGameParkPoints: "number",
607
+ endGameRobot1: "string",
608
+ endGameRobot2: "string",
609
+ endGameRobot3: "string",
610
+ endGameSpotLightBonusPoints: "number",
611
+ endGameTotalStagePoints: "number",
612
+ ensembleBonusAchieved: "boolean",
613
+ ensembleBonusOnStageRobotsThreshold: "number",
614
+ ensembleBonusStagePointsThreshold: "number",
615
+ foulCount: "number",
616
+ foulPoints: "number",
617
+ g206Penalty: "boolean",
618
+ g408Penalty: "boolean",
619
+ g424Penalty: "boolean",
620
+ melodyBonusAchieved: "boolean",
621
+ melodyBonusThreshold: "number",
622
+ melodyBonusThresholdCoop: "number",
623
+ melodyBonusThresholdNonCoop: "number",
624
+ micCenterStage: "boolean",
625
+ micStageLeft: "boolean",
626
+ micStageRight: "boolean",
627
+ rp: "number",
628
+ techFoulCount: "number",
629
+ teleopAmpNoteCount: "number",
630
+ teleopAmpNotePoints: "number",
631
+ teleopPoints: "number",
632
+ teleopSpeakerNoteAmplifiedCount: "number",
633
+ teleopSpeakerNoteAmplifiedPoints: "number",
634
+ teleopSpeakerNoteCount: "number",
635
+ teleopSpeakerNotePoints: "number",
636
+ teleopTotalNotePoints: "number",
637
+ totalPoints: "number",
638
+ trapCenterStage: "boolean",
639
+ trapStageLeft: "boolean",
640
+ trapStageRight: "boolean"
641
+ }).partial(),
642
+ "2025": type4({
643
+ adjustPoints: "number",
644
+ algaePoints: "number",
645
+ autoBonusAchieved: "boolean",
646
+ autoCoralCount: "number",
647
+ autoCoralPoints: "number",
648
+ autoLineRobot1: "'Yes' | 'No'",
649
+ autoLineRobot2: "'Yes' | 'No'",
650
+ autoLineRobot3: "'Yes' | 'No'",
651
+ autoMobilityPoints: "number",
652
+ autoPoints: "number",
653
+ autoReef: reef,
654
+ bargeBonusAchieved: "boolean",
655
+ coopertitionCriteriaMet: "boolean",
656
+ coralBonusAchieved: "boolean",
657
+ endGameBargePoints: "number",
658
+ endGameRobot1: "'None' | 'Parked' | 'ShallowCage' | 'DeepCage'",
659
+ endGameRobot2: "'None' | 'Parked' | 'ShallowCage' | 'DeepCage'",
660
+ endGameRobot3: "'None' | 'Parked' | 'ShallowCage' | 'DeepCage'",
661
+ foulCount: "number",
662
+ foulPoints: "number",
663
+ g206Penalty: "boolean",
664
+ g410Penalty: "boolean",
665
+ g418Penalty: "boolean",
666
+ g428Penalty: "boolean",
667
+ netAlgaeCount: "number",
668
+ rp: "number",
669
+ techFoulCount: "number",
670
+ teleopCoralCount: "number",
671
+ teleopCoralPoints: "number",
672
+ teleopPoints: "number",
673
+ teleopReef: reef,
674
+ totalPoints: "number",
675
+ wallAlgaeCount: "number"
676
+ }).partial(),
677
+ "2026": type4({
678
+ adjustPoints: "number",
679
+ autoTowerPoints: "number",
680
+ autoTowerRobot1: "'Level1' | 'Level2' | 'Level3' | 'None'",
681
+ autoTowerRobot2: "'Level1' | 'Level2' | 'Level3' | 'None'",
682
+ autoTowerRobot3: "'Level1' | 'Level2' | 'Level3' | 'None'",
683
+ endGameTowerPoints: "number",
684
+ endGameTowerRobot1: "'Level1' | 'Level2' | 'Level3' | 'None'",
685
+ endGameTowerRobot2: "'Level1' | 'Level2' | 'Level3' | 'None'",
686
+ endGameTowerRobot3: "'Level1' | 'Level2' | 'Level3' | 'None'",
687
+ energizedAcheived: "boolean",
688
+ foulPoints: "number",
689
+ g206Penalty: "boolean",
690
+ hubScore: {
691
+ autoCount: "number",
692
+ autoPoints: "number",
693
+ endgameCount: "number",
694
+ endgamePoints: "number",
695
+ shift1Count: "number",
696
+ shift1Points: "number",
697
+ shift2Count: "number",
698
+ shift2Points: "number",
699
+ shift3Count: "number",
700
+ shift3Points: "number",
701
+ shift4Count: "number",
702
+ shift4Points: "number",
703
+ teleopCount: "number",
704
+ teleopPoints: "number",
705
+ totalCount: "number",
706
+ totalPoints: "number",
707
+ transitionCount: "number",
708
+ transitionPoints: "number"
709
+ },
710
+ majorFoulCount: "number",
711
+ minorFoulCount: "number",
712
+ rp: "number",
713
+ superchargedAcheived: "boolean",
714
+ totalAutoPoints: "number",
715
+ totalPoints: "number",
716
+ totalTeleopPoints: "number",
717
+ totalTowerPoints: "number",
718
+ traversalAchieved: "boolean"
719
+ }).partial()
720
+ };
721
+ var matchScoreBreakdownYearsMatches = {
722
+ "2015": type4({
723
+ red: matchScoreBreakdownYearsAlliances["2015"],
724
+ blue: matchScoreBreakdownYearsAlliances["2015"],
725
+ coopertition: "'None' | 'Unknown' | 'Stack'",
726
+ coopertition_points: "number",
727
+ yearOfCompetition: "2015"
728
+ }),
729
+ "2016": type4({
730
+ red: matchScoreBreakdownYearsAlliances["2016"],
731
+ blue: matchScoreBreakdownYearsAlliances["2016"],
732
+ yearOfCompetition: "2016"
733
+ }),
734
+ "2017": type4({
735
+ red: matchScoreBreakdownYearsAlliances["2017"],
736
+ blue: matchScoreBreakdownYearsAlliances["2017"],
737
+ yearOfCompetition: "2017"
738
+ }),
739
+ "2018": type4({
740
+ red: matchScoreBreakdownYearsAlliances["2018"],
741
+ blue: matchScoreBreakdownYearsAlliances["2018"],
742
+ yearOfCompetition: "2018"
743
+ }),
744
+ "2019": type4({
745
+ red: matchScoreBreakdownYearsAlliances["2019"],
746
+ blue: matchScoreBreakdownYearsAlliances["2019"],
747
+ yearOfCompetition: "2019"
748
+ }),
749
+ "2020": type4({
750
+ red: matchScoreBreakdownYearsAlliances["2020"],
751
+ blue: matchScoreBreakdownYearsAlliances["2020"],
752
+ yearOfCompetition: "2020"
753
+ }),
754
+ "2022": type4({
755
+ red: matchScoreBreakdownYearsAlliances["2022"],
756
+ blue: matchScoreBreakdownYearsAlliances["2022"],
757
+ yearOfCompetition: "2022"
758
+ }),
759
+ "2023": type4({
760
+ red: matchScoreBreakdownYearsAlliances["2023"],
761
+ blue: matchScoreBreakdownYearsAlliances["2023"],
762
+ yearOfCompetition: "2023"
763
+ }),
764
+ "2024": type4({
765
+ red: matchScoreBreakdownYearsAlliances["2024"],
766
+ blue: matchScoreBreakdownYearsAlliances["2024"],
767
+ yearOfCompetition: "2024"
768
+ }),
769
+ "2025": type4({
770
+ red: matchScoreBreakdownYearsAlliances["2025"],
771
+ blue: matchScoreBreakdownYearsAlliances["2025"],
772
+ yearOfCompetition: "2025"
773
+ }),
774
+ "2026": type4({
775
+ red: matchScoreBreakdownYearsAlliances["2026"],
776
+ blue: matchScoreBreakdownYearsAlliances["2026"],
777
+ yearOfCompetition: "2026"
778
+ })
779
+ };
780
+ var msb = matchScoreBreakdownYearsMatches;
781
+ var Match_alliance = type4({
782
+ score: "number | null",
783
+ team_keys: "string[]",
784
+ surrogate_team_keys: "string[]",
785
+ dq_team_keys: "string[]"
786
+ });
787
+ var Match_Simple = type4({
788
+ key: "string",
789
+ comp_level: "'qm' | 'ef' | 'qf' | 'sf' |'f'",
790
+ set_number: "number",
791
+ match_number: "number",
792
+ alliances: type4({ red: Match_alliance, blue: Match_alliance }),
793
+ winning_alliance: "'red' | 'blue' | ''",
794
+ event_key: "string",
795
+ time: "number | null",
796
+ actual_time: "number | null",
797
+ predicted_time: "number | null"
798
+ });
799
+ var Match = Match_Simple.and({
800
+ videos: type4({ type: "string", key: "string" }).array(),
801
+ score_breakdown: msb["2015"].or(msb["2016"]).or(msb["2017"]).or(msb["2018"]).or(msb["2019"]).or(msb["2020"]).or(msb["2022"]).or(msb["2023"]).or(msb["2024"]).or(msb["2025"])
802
+ });
803
+
804
+ // src/types/endpoints/teams.ts
805
+ import { type as type5 } from "arktype";
806
+ var teamEndpoints = {
807
+ "/teams/{page_num}": {
808
+ schema: Team.array(),
809
+ arguments: type5(["number"])
810
+ },
811
+ "/teams/{page_num}/simple": {
812
+ schema: Team_Simple.array(),
813
+ arguments: type5(["number"])
814
+ },
815
+ "/teams/{page_num}/keys": {
816
+ schema: type5("string[]"),
817
+ arguments: type5(["number"])
818
+ },
819
+ "/teams/{year}/{page_num}": {
820
+ schema: Team.array(),
821
+ arguments: type5(["number", "number"])
822
+ },
823
+ "/teams/{year}/{page_num}/simple": {
824
+ schema: Team_Simple.array(),
825
+ arguments: type5(["number", "number"])
826
+ },
827
+ "/teams/{year}/{page_num}/keys": {
828
+ schema: type5("string[]"),
829
+ arguments: type5(["number", "number"])
830
+ },
831
+ "/team/{team_key}": {
832
+ schema: Team,
833
+ arguments: type5(["string"])
834
+ },
835
+ "/team/{team_key}/simple": {
836
+ schema: Team_Simple,
837
+ arguments: type5(["string"])
838
+ },
839
+ "/team/{team_key}/history": {
840
+ schema: type5({ events: Event.array(), awards: Award.array() }),
841
+ arguments: type5(["string"])
842
+ },
843
+ "/team/{team_key}/years_participated": {
844
+ schema: type5("number[]"),
845
+ arguments: type5(["string"])
846
+ },
847
+ "/team/{team_key}/districts": {
848
+ schema: District_List.array(),
849
+ arguments: type5(["string"])
850
+ },
851
+ "/team/{team_key}/robots": {
852
+ schema: Team_Robot.array(),
853
+ arguments: type5(["string"])
854
+ },
855
+ "/team/{team_key}/events": {
856
+ schema: Event.array(),
857
+ arguments: type5(["string"])
858
+ },
859
+ "/team/{team_key}/events/simple": {
860
+ schema: Event_Simple.array(),
861
+ arguments: type5(["string"])
862
+ },
863
+ "/team/{team_key}/events/keys": {
864
+ schema: type5("string[]"),
865
+ arguments: type5(["string"])
866
+ },
867
+ "/team/{team_key}/events/{year}": {
868
+ schema: Event.array(),
869
+ arguments: type5(["string", "number"])
870
+ },
871
+ "/team/{team_key}/events/{year}/simple": {
872
+ schema: Event_Simple.array(),
873
+ arguments: type5(["string", "number"])
874
+ },
875
+ "/team/{team_key}/events/{year}/keys": {
876
+ schema: type5("string[]"),
877
+ arguments: type5(["string", "number"])
878
+ },
879
+ "/team/{team_key}/events/{year}/statuses": {
880
+ schema: type5({
881
+ "[string]": Team_Event_Status
882
+ }),
883
+ arguments: type5(["string", "number"])
884
+ },
885
+ "/team/{team_key}/event/{event_key}/matches": {
886
+ schema: Match.array(),
887
+ arguments: type5(["string", "string"]),
888
+ transformMatch: ({ key: eventKey }, schema) => {
889
+ if (eventKey && parseInt(eventKey.slice(0, 4)) && Array.isArray(schema) && schema.every((v) => v && typeof v === "object")) {
890
+ for (const member of schema) {
891
+ member["score_breakdown"]["yearOfCompetition"] = parseInt(
892
+ eventKey.slice(0, 4)
893
+ );
894
+ }
895
+ }
896
+ return schema;
897
+ }
898
+ },
899
+ "/team/{team_key}/event/{event_key}/matches/simple": {
900
+ schema: Match_Simple.array(),
901
+ arguments: type5(["string", "string"])
902
+ },
903
+ "/team/{team_key}/event/{event_key}/matches/keys": {
904
+ schema: type5("string[]"),
905
+ arguments: type5(["string", "string"])
906
+ },
907
+ "/team/{team_key}/event/{event_key}/awards": {
908
+ schema: Award.array(),
909
+ arguments: type5(["string", "string"])
910
+ },
911
+ "/team/{team_key}/event/{event_key}/status": {
912
+ schema: type5(Team_Event_Status, "|", "null"),
913
+ arguments: type5(["string", "string"])
914
+ },
915
+ "/team/{team_key}/awards": {
916
+ schema: Award.array(),
917
+ arguments: type5(["string"])
918
+ },
919
+ "/team/{team_key}/awards/{year}": {
920
+ schema: Award.array(),
921
+ arguments: type5(["string", "number"])
922
+ },
923
+ "/team/{team_key}/matches/{year}": {
924
+ schema: Match.array(),
925
+ arguments: type5(["string", "number"]),
926
+ transformMatch: ({ year }, schema) => {
927
+ if (year && Array.isArray(schema) && schema.every((v) => v && typeof v === "object")) {
928
+ for (const member of schema) {
929
+ member["score_breakdown"]["yearOfCompetition"] = year;
930
+ }
931
+ }
932
+ return schema;
933
+ }
934
+ },
935
+ "/team/{team_key}/matches/{year}/simple": {
936
+ schema: Match_Simple.array(),
937
+ arguments: type5(["string", "number"])
938
+ },
939
+ "/team/{team_key}/matches/{year}/keys": {
940
+ schema: type5("string[]"),
941
+ arguments: type5(["string", "number"])
942
+ },
943
+ "/team/{team_key}/media/{year}": {
944
+ schema: Media.array(),
945
+ arguments: type5(["string", "number"])
946
+ },
947
+ "/team/{team_key}/media/tag/{media_tag}": {
948
+ schema: Media.array(),
949
+ arguments: type5(["string", "string"])
950
+ },
951
+ "/team/{team_key}/media/tag/{media_tag}/{year}": {
952
+ schema: Media.array(),
953
+ arguments: type5(["string", "string", "number"])
954
+ },
955
+ "/team/{team_key}/social_media": {
956
+ schema: Media.array(),
957
+ arguments: type5(["string"])
958
+ }
959
+ };
960
+
961
+ // src/types/schemas/status.ts
962
+ import { type as type6 } from "arktype";
963
+ var API_Status_App_Version = type6({
964
+ min_app_version: "number",
965
+ latest_app_version: "number"
966
+ });
967
+
968
+ // src/types/endpoints/status.ts
969
+ import { type as type7 } from "arktype";
970
+ var status = type7({
971
+ current_season: "number",
972
+ max_season: "number",
973
+ is_datafeed_down: "boolean",
974
+ down_events: "string[]",
975
+ ios: API_Status_App_Version,
976
+ android: API_Status_App_Version
977
+ });
978
+ var statusEndpoints = {
979
+ "/status": {
980
+ schema: status,
981
+ arguments: type7([])
982
+ }
983
+ };
984
+
985
+ // src/types/endpoints/events.ts
986
+ import { type as type8 } from "arktype";
987
+ var rankings = type8({
988
+ rankings: type8({
989
+ matches_played: "number",
990
+ qual_average: "number | null",
991
+ extra_stats: "number[]",
992
+ sort_orders: "number[] | null",
993
+ record: type8(WLT_Record, "|", "null"),
994
+ rank: "number",
995
+ dq: "number",
996
+ team_key: "string"
997
+ }).array(),
998
+ extra_stats_info: type8({
999
+ precision: "number",
1000
+ name: "string"
1001
+ }).array(),
1002
+ sort_order_info: type8({
1003
+ precision: "number",
1004
+ name: "string"
1005
+ }).array()
1006
+ });
1007
+ var eventPoints = type8({
1008
+ points: type8({
1009
+ "[string]": type8({
1010
+ total: "number",
1011
+ alliance_points: "number",
1012
+ elim_points: "number",
1013
+ award_points: "number",
1014
+ qual_points: "number"
1015
+ })
1016
+ }),
1017
+ "tiebreakers?": type8({
1018
+ "[string]": type8({
1019
+ highest_qual_scores: "number[]",
1020
+ qual_points: "number"
1021
+ }).partial()
1022
+ })
1023
+ });
1024
+ var eventEndpoints = {
1025
+ "/events/{year}": {
1026
+ schema: Event.array(),
1027
+ arguments: type8(["number"])
1028
+ },
1029
+ "/events/{year}/simple": {
1030
+ schema: Event_Simple.array(),
1031
+ arguments: type8(["number"])
1032
+ },
1033
+ "/events/{year}/keys": {
1034
+ schema: type8("string[]"),
1035
+ arguments: type8(["number"])
1036
+ },
1037
+ "/event/{event_key}": {
1038
+ schema: Event,
1039
+ arguments: type8(["string"])
1040
+ },
1041
+ "/event/{event_key}/simple": {
1042
+ schema: Event_Simple,
1043
+ arguments: type8(["string"])
1044
+ },
1045
+ "/event/{event_key}/alliances": {
1046
+ schema: type8(Elimination_Alliance.array(), "|", "null"),
1047
+ arguments: type8(["string"])
1048
+ },
1049
+ "/event/{event_key}/insights": {
1050
+ schema: type8(
1051
+ {
1052
+ qual: "unknown",
1053
+ playoff: "unknown"
1054
+ },
1055
+ "|",
1056
+ "null"
1057
+ ),
1058
+ arguments: type8(["string"])
1059
+ },
1060
+ "/event/{event_key}/oprs": {
1061
+ schema: type8({
1062
+ oprs: { "[string]": "number" },
1063
+ dprs: { "[string]": "number" },
1064
+ ccwms: { "[string]": "number" }
1065
+ }),
1066
+ arguments: type8(["string"])
1067
+ },
1068
+ "/event/{event_key}/coprs": {
1069
+ schema: type8({ "[string]": { "[string]": "number" } }),
1070
+ arguments: type8(["string"])
1071
+ },
1072
+ "/event/{event_key}/predictions": {
1073
+ schema: type8({ "[string]": "unknown" }, "|", "null"),
1074
+ arguments: type8(["string"])
1075
+ },
1076
+ "/event/{event_key}/rankings": {
1077
+ schema: type8(rankings, "|", "null"),
1078
+ arguments: type8(["string"])
1079
+ },
1080
+ "/event/{event_key}/district_points": {
1081
+ schema: type8(eventPoints, "|", "null"),
1082
+ arguments: type8(["string"])
1083
+ },
1084
+ "/event/{event_key}/regional_champs_pool_points": {
1085
+ schema: type8(eventPoints, "|", "null"),
1086
+ arguments: type8(["string"])
1087
+ },
1088
+ "/event/{event_key}/advancement_points": {
1089
+ schema: type8(eventPoints, "|", "null"),
1090
+ arguments: type8(["string"])
1091
+ },
1092
+ "/event/{event_key}/teams": {
1093
+ schema: Team.array(),
1094
+ arguments: type8(["string"])
1095
+ },
1096
+ "/event/{event_key}/teams/simple": {
1097
+ schema: Team_Simple.array(),
1098
+ arguments: type8(["string"])
1099
+ },
1100
+ "/event/{event_key}/teams/keys": {
1101
+ schema: type8("string[]"),
1102
+ arguments: type8(["string"])
1103
+ },
1104
+ "/event/{event_key}/teams/statuses": {
1105
+ schema: type8({ "[string]": Team_Event_Status }),
1106
+ arguments: type8(["string"])
1107
+ },
1108
+ "/event/{event_key}/matches": {
1109
+ schema: Match.array(),
1110
+ arguments: type8(["string"]),
1111
+ transformMatch: ({ key }, schema) => {
1112
+ if (key && parseInt(key.slice(0, 4)) && Array.isArray(schema) && schema.every((v) => v && typeof v === "object")) {
1113
+ for (const member of schema) {
1114
+ member["score_breakdown"]["yearOfCompetition"] = parseInt(
1115
+ key.slice(0, 4)
1116
+ );
1117
+ }
1118
+ }
1119
+ return schema;
1120
+ }
1121
+ },
1122
+ "/event/{event_key}/matches/simple": {
1123
+ schema: Match_Simple.array(),
1124
+ arguments: type8(["string"])
1125
+ },
1126
+ "/event/{event_key}/matches/keys": {
1127
+ schema: type8("string[]"),
1128
+ arguments: type8(["string"])
1129
+ },
1130
+ "/event/{event_key}/awards": {
1131
+ schema: Award.array(),
1132
+ arguments: type8(["string"])
1133
+ },
1134
+ "/event/{event_key}/team_media": {
1135
+ schema: Media.array(),
1136
+ arguments: type8(["string"])
1137
+ }
1138
+ };
1139
+
1140
+ // src/types/endpoints/matches.ts
1141
+ import { type as type9 } from "arktype";
1142
+ var matchEndpoints = {
1143
+ "/match/{match_key}": {
1144
+ schema: Match,
1145
+ arguments: type9(["string"]),
1146
+ transformMatch: ({ key: eventKey }, schema) => {
1147
+ if (eventKey && parseInt(eventKey.slice(0, 4)) && typeof schema === "object" && schema) {
1148
+ let newSchema = schema;
1149
+ newSchema["score_breakdown"]["yearOfCompetition"] = parseInt(
1150
+ eventKey.slice(0, 4)
1151
+ );
1152
+ return newSchema;
1153
+ }
1154
+ return schema;
1155
+ }
1156
+ },
1157
+ "/match/{match_key}/simple": {
1158
+ schema: Match_Simple,
1159
+ arguments: type9(["string"])
1160
+ }
1161
+ };
1162
+
1163
+ // src/types/endpoints/districts.ts
1164
+ import { type as type10 } from "arktype";
1165
+ var districtEndpoints = {
1166
+ "/districts/{year}": {
1167
+ schema: District_List.array(),
1168
+ arguments: type10(["number"])
1169
+ },
1170
+ "/district/{district_abbreviation}/history": {
1171
+ schema: District_List.array(),
1172
+ arguments: type10(["string"])
1173
+ },
1174
+ "/district/{district_key}/events": {
1175
+ schema: Event.array(),
1176
+ arguments: type10(["string"])
1177
+ },
1178
+ "/district/{district_key}/awards": {
1179
+ schema: Award.array(),
1180
+ arguments: type10(["string"])
1181
+ },
1182
+ "/district/{district_key}/events/simple": {
1183
+ schema: Event_Simple.array(),
1184
+ arguments: type10(["string"])
1185
+ },
1186
+ "/district/{district_key}/events/keys": {
1187
+ schema: type10("string[]"),
1188
+ arguments: type10(["string"])
1189
+ },
1190
+ "/district/{district_key}/teams": {
1191
+ schema: Team.array(),
1192
+ arguments: type10(["string"])
1193
+ },
1194
+ "/district/{district_key}/teams/simple": {
1195
+ schema: Team_Simple.array(),
1196
+ arguments: type10(["string"])
1197
+ },
1198
+ "/district/{district_key}/teams/keys": {
1199
+ schema: type10("string[]"),
1200
+ arguments: type10(["string"])
1201
+ },
1202
+ "/district/{district_key}/rankings": {
1203
+ schema: type10(District_Ranking.array(), "|", "null"),
1204
+ arguments: type10(["string"])
1205
+ },
1206
+ "/district/{district_key}/advancement": {
1207
+ schema: type10({ "[string]": District_Advancement }, "|", "null"),
1208
+ arguments: type10(["string"])
1209
+ }
1210
+ };
1211
+
1212
+ // src/types/schemas/regionalAdvancements.ts
1213
+ import { type as type11 } from "arktype";
1214
+ var Regional_Advancement = type11({
1215
+ cmp: "boolean",
1216
+ cmp_status: "'NotInvited' | 'PreQualified' | 'EventQualified' | 'PoolQualified' | 'Declined'",
1217
+ qualifying_event: "string?",
1218
+ qualifying_award_name: "string?",
1219
+ qualifying_pool_week: "number?"
1220
+ });
1221
+ var Regional_Ranking = type11({
1222
+ team_key: "string",
1223
+ rank: "number",
1224
+ rookie_bonus: "number?",
1225
+ point_total: "number",
1226
+ single_event_bonus: "number?",
1227
+ event_points: type11({
1228
+ total: "number",
1229
+ alliance_points: "number",
1230
+ elim_points: "number",
1231
+ award_points: "number",
1232
+ event_key: "string",
1233
+ qual_points: "number"
1234
+ }).array()
1235
+ });
1236
+
1237
+ // src/types/endpoints/regionalAdvancements.ts
1238
+ import { type as type12 } from "arktype";
1239
+ var regionalAdvancementEndpoints = {
1240
+ "/regional_advancement/{year}": {
1241
+ schema: type12({ "[string]": Regional_Advancement }),
1242
+ arguments: type12(["number"])
1243
+ },
1244
+ "/regional_advancement/{year}/rankings": {
1245
+ schema: Regional_Ranking.array(),
1246
+ arguments: type12(["number"])
1247
+ }
1248
+ };
1249
+
1250
+ // src/types/schemas/insights.ts
1251
+ import { type as type13 } from "arktype";
1252
+ var LeaderboardInsights = type13({
1253
+ data: {
1254
+ rankings: type13({
1255
+ value: "number",
1256
+ keys: "string[]"
1257
+ }).array(),
1258
+ key_type: "'team' | 'event' | 'match'"
1259
+ },
1260
+ name: "string",
1261
+ year: "number"
1262
+ });
1263
+ var NotablesInsight = type13({
1264
+ data: {
1265
+ entries: type13({
1266
+ context: "string[]",
1267
+ team_key: "string"
1268
+ }).array()
1269
+ },
1270
+ name: "string",
1271
+ year: "number"
1272
+ });
1273
+
1274
+ // src/types/endpoints/insights.ts
1275
+ import { type as type14 } from "arktype";
1276
+ var insightEndpoints = {
1277
+ "/insights/leaderboards/{year}": {
1278
+ schema: LeaderboardInsights.array(),
1279
+ arguments: type14(["number"])
1280
+ },
1281
+ "/insights/notables/{year}": {
1282
+ schema: NotablesInsight.array(),
1283
+ arguments: type14(["number"])
1284
+ }
1285
+ };
1286
+
1287
+ // src/types/endpoints/index.ts
1288
+ import { type as type15 } from "arktype";
1289
+ var Search_Index = type15({
1290
+ teams: type15({
1291
+ key: "string",
1292
+ nickname: "string"
1293
+ }).array(),
1294
+ events: type15({
1295
+ key: "string",
1296
+ name: "string"
1297
+ }).array()
1298
+ });
1299
+ var searchIndex = {
1300
+ "/search_index": {
1301
+ schema: Search_Index,
1302
+ arguments: type15([])
1303
+ }
1304
+ };
1305
+ var endpoints = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, statusEndpoints), teamEndpoints), eventEndpoints), matchEndpoints), districtEndpoints), regionalAdvancementEndpoints), insightEndpoints), searchIndex);
1306
+
1307
+ // src/index.ts
1308
+ import { ArkErrors } from "arktype";
1309
+ function createTBACaller(api_key) {
1310
+ return async (endpoint, ...args) => await TBA(endpoint, api_key, ...args);
1311
+ }
1312
+ async function TBA(endpoint, api_key, ...args) {
1313
+ let numArg = -1;
1314
+ const filledEndpoint = endpoint.replace(/{(.+?)}/g, () => {
1315
+ numArg++;
1316
+ return args[numArg].toString();
1317
+ });
1318
+ const result = await tryCatch(
1319
+ fetch(`https://www.thebluealliance.com/api/v3${filledEndpoint}`, {
1320
+ headers: {
1321
+ "X-TBA-Auth-Key": api_key
1322
+ }
1323
+ })
1324
+ );
1325
+ if (result.error)
1326
+ return {
1327
+ data: null,
1328
+ error: result.error
1329
+ };
1330
+ if (result.data.status !== 200)
1331
+ return {
1332
+ data: null,
1333
+ error: new Error(`${result.data.status} - ${result.data.statusText}`)
1334
+ };
1335
+ const json = await tryCatch(result.data.json());
1336
+ if (json.error)
1337
+ return {
1338
+ data: null,
1339
+ error: new Error(
1340
+ `JSON didn't parse for endpoint ${endpoint}. Please contact the developers of the TBArequest package with this error: ${json.error.message}`
1341
+ )
1342
+ };
1343
+ if ("transformMatch" in endpoints[endpoint]) {
1344
+ let data;
1345
+ switch (endpoint) {
1346
+ case "/event/{event_key}/matches":
1347
+ case "/match/{match_key}": {
1348
+ data = { key: args[0] };
1349
+ break;
1350
+ }
1351
+ case "/team/{team_key}/event/{event_key}/matches": {
1352
+ data = { key: args[1] };
1353
+ break;
1354
+ }
1355
+ case "/team/{team_key}/matches/{year}": {
1356
+ data = { year: args[1] };
1357
+ break;
1358
+ }
1359
+ default: {
1360
+ data = {};
1361
+ }
1362
+ }
1363
+ json.data = endpoints[endpoint].transformMatch(
1364
+ data,
1365
+ json.data
1366
+ );
1367
+ }
1368
+ let schema = endpoints[endpoint].schema(json.data);
1369
+ if (schema instanceof ArkErrors)
1370
+ return {
1371
+ data: null,
1372
+ error: new Error(
1373
+ `Schema for endpoint ${endpoint} didn't work. Please contact the developers of the TBArequest package with this error: ${schema}`
1374
+ )
1375
+ };
1376
+ return { data: schema, error: null };
1377
+ }
1378
+ export {
1379
+ createTBACaller
1380
+ };