tbarequest 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 +2 -2
- package/dist/index.js +23 -1
- package/dist/types/endpoints/events.d.ts +14 -0
- package/dist/types/endpoints/events.js +11 -0
- package/dist/types/endpoints/matches.d.ts +14 -0
- package/dist/types/endpoints/matches.js +8 -0
- package/dist/types/endpoints/regionalAdvancements.d.ts +0 -1
- package/dist/types/endpoints/regionalAdvancements.js +0 -1
- package/dist/types/endpoints/teams.d.ts +28 -0
- package/dist/types/endpoints/teams.js +21 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/schemas/matches.d.ts +20 -0
- package/dist/types/schemas/matches.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,8 +15,8 @@ import { createTBACaller } from "tbarequest";
|
|
|
15
15
|
|
|
16
16
|
const tba = createTBACaller("api_key")
|
|
17
17
|
|
|
18
|
-
const status = tba("/status")
|
|
19
|
-
const team = tba("/teams/{team_key}", 1014)
|
|
18
|
+
const status = await tba("/status")
|
|
19
|
+
const team = await tba("/teams/{team_key}", 1014)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
The `tba` function can call an endpoint and require all necessary arguments, and then return the results that are type-safe.
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,29 @@ async function TBA(endpoint, api_key, ...args) {
|
|
|
37
37
|
data: null,
|
|
38
38
|
error: new Error(`JSON didn't parse for endpoint ${endpoint}. Please contact the developers of the TBArequest package with this error: ${json.error.message}`),
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
if ("transformMatch" in endpoints[endpoint]) {
|
|
41
|
+
let data;
|
|
42
|
+
switch (endpoint) {
|
|
43
|
+
case "/event/{event_key}/matches":
|
|
44
|
+
case "/match/{match_key}": {
|
|
45
|
+
data = { key: args[0] };
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "/team/{team_key}/event/{event_key}/matches": {
|
|
49
|
+
data = { key: args[1] };
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "/team/{team_key}/matches/{year}": {
|
|
53
|
+
data = { year: args[1] };
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
default: {
|
|
57
|
+
data = {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
json.data = endpoints[endpoint].transformMatch(data, json.data);
|
|
61
|
+
}
|
|
62
|
+
let schema = endpoints[endpoint].schema(json.data);
|
|
41
63
|
if (schema instanceof ArkErrors)
|
|
42
64
|
return {
|
|
43
65
|
data: null,
|
|
@@ -451,6 +451,7 @@ export declare const eventEndpoints: {
|
|
|
451
451
|
};
|
|
452
452
|
coopertition: "None" | "Unknown" | "Stack";
|
|
453
453
|
coopertition_points: number;
|
|
454
|
+
yearOfCompetition: 2015;
|
|
454
455
|
} | {
|
|
455
456
|
red: {
|
|
456
457
|
adjustPoints?: number | undefined;
|
|
@@ -534,6 +535,7 @@ export declare const eventEndpoints: {
|
|
|
534
535
|
towerFaceB?: string | undefined;
|
|
535
536
|
towerFaceC?: string | undefined;
|
|
536
537
|
};
|
|
538
|
+
yearOfCompetition: 2016;
|
|
537
539
|
} | {
|
|
538
540
|
red: {
|
|
539
541
|
adjustPoints?: number | undefined;
|
|
@@ -607,6 +609,7 @@ export declare const eventEndpoints: {
|
|
|
607
609
|
touchpadMiddle?: string | undefined;
|
|
608
610
|
touchpadNear?: string | undefined;
|
|
609
611
|
};
|
|
612
|
+
yearOfCompetition: 2017;
|
|
610
613
|
} | {
|
|
611
614
|
red: {
|
|
612
615
|
adjustPoints?: number | undefined;
|
|
@@ -686,6 +689,7 @@ export declare const eventEndpoints: {
|
|
|
686
689
|
vaultLevitateTotal?: number | undefined;
|
|
687
690
|
vaultPoints?: number | undefined;
|
|
688
691
|
};
|
|
692
|
+
yearOfCompetition: 2018;
|
|
689
693
|
} | {
|
|
690
694
|
red: {
|
|
691
695
|
adjustPoints?: number | undefined;
|
|
@@ -793,6 +797,7 @@ export declare const eventEndpoints: {
|
|
|
793
797
|
topRightRocketNear?: string | undefined;
|
|
794
798
|
totalPoints?: number | undefined;
|
|
795
799
|
};
|
|
800
|
+
yearOfCompetition: 2019;
|
|
796
801
|
} | {
|
|
797
802
|
red: {
|
|
798
803
|
adjustPoints?: number | undefined;
|
|
@@ -866,6 +871,7 @@ export declare const eventEndpoints: {
|
|
|
866
871
|
teleopPoints?: number | undefined;
|
|
867
872
|
totalPoints?: number | undefined;
|
|
868
873
|
};
|
|
874
|
+
yearOfCompetition: 2020;
|
|
869
875
|
} | {
|
|
870
876
|
red: {
|
|
871
877
|
adjustPoints?: number | undefined;
|
|
@@ -951,6 +957,7 @@ export declare const eventEndpoints: {
|
|
|
951
957
|
teleopPoints?: number | undefined;
|
|
952
958
|
totalPoints?: number | undefined;
|
|
953
959
|
};
|
|
960
|
+
yearOfCompetition: 2022;
|
|
954
961
|
} | {
|
|
955
962
|
red: {
|
|
956
963
|
activationBonusAchieved?: boolean | undefined;
|
|
@@ -1052,6 +1059,7 @@ export declare const eventEndpoints: {
|
|
|
1052
1059
|
totalChargeStationPoints?: number | undefined;
|
|
1053
1060
|
totalPoints?: number | undefined;
|
|
1054
1061
|
};
|
|
1062
|
+
yearOfCompetition: 2023;
|
|
1055
1063
|
} | {
|
|
1056
1064
|
red: {
|
|
1057
1065
|
adjustPoints?: number | undefined;
|
|
@@ -1161,6 +1169,7 @@ export declare const eventEndpoints: {
|
|
|
1161
1169
|
trapStageLeft?: boolean | undefined;
|
|
1162
1170
|
trapStageRight?: boolean | undefined;
|
|
1163
1171
|
};
|
|
1172
|
+
yearOfCompetition: 2024;
|
|
1164
1173
|
} | {
|
|
1165
1174
|
red: {
|
|
1166
1175
|
adjustPoints?: number | undefined;
|
|
@@ -1420,9 +1429,14 @@ export declare const eventEndpoints: {
|
|
|
1420
1429
|
totalPoints?: number | undefined;
|
|
1421
1430
|
wallAlgaeCount?: number | undefined;
|
|
1422
1431
|
};
|
|
1432
|
+
yearOfCompetition: 2025;
|
|
1423
1433
|
};
|
|
1424
1434
|
}[], {}>;
|
|
1425
1435
|
arguments: import("arktype/internal/methods/array.ts").ArrayType<[string], {}>;
|
|
1436
|
+
transformMatch: ({ key }: {
|
|
1437
|
+
year?: number;
|
|
1438
|
+
key?: string;
|
|
1439
|
+
}, schema: unknown) => unknown;
|
|
1426
1440
|
};
|
|
1427
1441
|
"/event/{event_key}/matches/simple": {
|
|
1428
1442
|
schema: import("arktype/internal/methods/array.ts").ArrayType<{
|
|
@@ -122,6 +122,17 @@ export const eventEndpoints = {
|
|
|
122
122
|
"/event/{event_key}/matches": {
|
|
123
123
|
schema: Match.array(),
|
|
124
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
|
+
},
|
|
125
136
|
},
|
|
126
137
|
"/event/{event_key}/matches/simple": {
|
|
127
138
|
schema: Match_Simple.array(),
|
|
@@ -83,6 +83,7 @@ export declare const matchEndpoints: {
|
|
|
83
83
|
};
|
|
84
84
|
coopertition: "None" | "Unknown" | "Stack";
|
|
85
85
|
coopertition_points: number;
|
|
86
|
+
yearOfCompetition: 2015;
|
|
86
87
|
} | {
|
|
87
88
|
red: {
|
|
88
89
|
adjustPoints?: number | undefined;
|
|
@@ -166,6 +167,7 @@ export declare const matchEndpoints: {
|
|
|
166
167
|
towerFaceB?: string | undefined;
|
|
167
168
|
towerFaceC?: string | undefined;
|
|
168
169
|
};
|
|
170
|
+
yearOfCompetition: 2016;
|
|
169
171
|
} | {
|
|
170
172
|
red: {
|
|
171
173
|
adjustPoints?: number | undefined;
|
|
@@ -239,6 +241,7 @@ export declare const matchEndpoints: {
|
|
|
239
241
|
touchpadMiddle?: string | undefined;
|
|
240
242
|
touchpadNear?: string | undefined;
|
|
241
243
|
};
|
|
244
|
+
yearOfCompetition: 2017;
|
|
242
245
|
} | {
|
|
243
246
|
red: {
|
|
244
247
|
adjustPoints?: number | undefined;
|
|
@@ -318,6 +321,7 @@ export declare const matchEndpoints: {
|
|
|
318
321
|
vaultLevitateTotal?: number | undefined;
|
|
319
322
|
vaultPoints?: number | undefined;
|
|
320
323
|
};
|
|
324
|
+
yearOfCompetition: 2018;
|
|
321
325
|
} | {
|
|
322
326
|
red: {
|
|
323
327
|
adjustPoints?: number | undefined;
|
|
@@ -425,6 +429,7 @@ export declare const matchEndpoints: {
|
|
|
425
429
|
topRightRocketNear?: string | undefined;
|
|
426
430
|
totalPoints?: number | undefined;
|
|
427
431
|
};
|
|
432
|
+
yearOfCompetition: 2019;
|
|
428
433
|
} | {
|
|
429
434
|
red: {
|
|
430
435
|
adjustPoints?: number | undefined;
|
|
@@ -498,6 +503,7 @@ export declare const matchEndpoints: {
|
|
|
498
503
|
teleopPoints?: number | undefined;
|
|
499
504
|
totalPoints?: number | undefined;
|
|
500
505
|
};
|
|
506
|
+
yearOfCompetition: 2020;
|
|
501
507
|
} | {
|
|
502
508
|
red: {
|
|
503
509
|
adjustPoints?: number | undefined;
|
|
@@ -583,6 +589,7 @@ export declare const matchEndpoints: {
|
|
|
583
589
|
teleopPoints?: number | undefined;
|
|
584
590
|
totalPoints?: number | undefined;
|
|
585
591
|
};
|
|
592
|
+
yearOfCompetition: 2022;
|
|
586
593
|
} | {
|
|
587
594
|
red: {
|
|
588
595
|
activationBonusAchieved?: boolean | undefined;
|
|
@@ -684,6 +691,7 @@ export declare const matchEndpoints: {
|
|
|
684
691
|
totalChargeStationPoints?: number | undefined;
|
|
685
692
|
totalPoints?: number | undefined;
|
|
686
693
|
};
|
|
694
|
+
yearOfCompetition: 2023;
|
|
687
695
|
} | {
|
|
688
696
|
red: {
|
|
689
697
|
adjustPoints?: number | undefined;
|
|
@@ -793,6 +801,7 @@ export declare const matchEndpoints: {
|
|
|
793
801
|
trapStageLeft?: boolean | undefined;
|
|
794
802
|
trapStageRight?: boolean | undefined;
|
|
795
803
|
};
|
|
804
|
+
yearOfCompetition: 2024;
|
|
796
805
|
} | {
|
|
797
806
|
red: {
|
|
798
807
|
adjustPoints?: number | undefined;
|
|
@@ -1052,9 +1061,14 @@ export declare const matchEndpoints: {
|
|
|
1052
1061
|
totalPoints?: number | undefined;
|
|
1053
1062
|
wallAlgaeCount?: number | undefined;
|
|
1054
1063
|
};
|
|
1064
|
+
yearOfCompetition: 2025;
|
|
1055
1065
|
};
|
|
1056
1066
|
}, {}>;
|
|
1057
1067
|
arguments: import("arktype/internal/methods/array.ts").ArrayType<[string], {}>;
|
|
1068
|
+
transformMatch: ({ key: eventKey }: {
|
|
1069
|
+
year?: number;
|
|
1070
|
+
key?: string;
|
|
1071
|
+
}, schema: unknown) => any;
|
|
1058
1072
|
};
|
|
1059
1073
|
"/match/{match_key}/simple": {
|
|
1060
1074
|
schema: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
@@ -4,6 +4,14 @@ export const matchEndpoints = {
|
|
|
4
4
|
"/match/{match_key}": {
|
|
5
5
|
schema: Match,
|
|
6
6
|
arguments: type(["string"]),
|
|
7
|
+
transformMatch: ({ key: eventKey }, schema) => {
|
|
8
|
+
if (eventKey && parseInt(eventKey.slice(0, 4)) && typeof schema === "object" && schema) {
|
|
9
|
+
let newSchema = schema;
|
|
10
|
+
newSchema["score_breakdown"]["yearOfCompetition"] = parseInt(eventKey.slice(0, 4));
|
|
11
|
+
return newSchema;
|
|
12
|
+
}
|
|
13
|
+
return schema;
|
|
14
|
+
}
|
|
7
15
|
},
|
|
8
16
|
"/match/{match_key}/simple": {
|
|
9
17
|
schema: Match_Simple,
|
|
@@ -10,7 +10,6 @@ export declare const regionalAdvancementEndpoints: {
|
|
|
10
10
|
};
|
|
11
11
|
}, {}>;
|
|
12
12
|
arguments: import("arktype/internal/methods/array.ts").ArrayType<[number], {}>;
|
|
13
|
-
optional: true;
|
|
14
13
|
};
|
|
15
14
|
"/regional_advancement/{year}/rankings": {
|
|
16
15
|
schema: import("arktype/internal/methods/array.ts").ArrayType<{
|
|
@@ -4,7 +4,6 @@ export const regionalAdvancementEndpoints = {
|
|
|
4
4
|
"/regional_advancement/{year}": {
|
|
5
5
|
schema: type({ "[string]": Regional_Advancement }),
|
|
6
6
|
arguments: type(["number"]),
|
|
7
|
-
optional: true,
|
|
8
7
|
},
|
|
9
8
|
"/regional_advancement/{year}/rankings": {
|
|
10
9
|
schema: Regional_Ranking.array(),
|
|
@@ -443,6 +443,7 @@ export declare const teamEndpoints: {
|
|
|
443
443
|
};
|
|
444
444
|
coopertition: "None" | "Unknown" | "Stack";
|
|
445
445
|
coopertition_points: number;
|
|
446
|
+
yearOfCompetition: 2015;
|
|
446
447
|
} | {
|
|
447
448
|
red: {
|
|
448
449
|
adjustPoints?: number | undefined;
|
|
@@ -526,6 +527,7 @@ export declare const teamEndpoints: {
|
|
|
526
527
|
towerFaceB?: string | undefined;
|
|
527
528
|
towerFaceC?: string | undefined;
|
|
528
529
|
};
|
|
530
|
+
yearOfCompetition: 2016;
|
|
529
531
|
} | {
|
|
530
532
|
red: {
|
|
531
533
|
adjustPoints?: number | undefined;
|
|
@@ -599,6 +601,7 @@ export declare const teamEndpoints: {
|
|
|
599
601
|
touchpadMiddle?: string | undefined;
|
|
600
602
|
touchpadNear?: string | undefined;
|
|
601
603
|
};
|
|
604
|
+
yearOfCompetition: 2017;
|
|
602
605
|
} | {
|
|
603
606
|
red: {
|
|
604
607
|
adjustPoints?: number | undefined;
|
|
@@ -678,6 +681,7 @@ export declare const teamEndpoints: {
|
|
|
678
681
|
vaultLevitateTotal?: number | undefined;
|
|
679
682
|
vaultPoints?: number | undefined;
|
|
680
683
|
};
|
|
684
|
+
yearOfCompetition: 2018;
|
|
681
685
|
} | {
|
|
682
686
|
red: {
|
|
683
687
|
adjustPoints?: number | undefined;
|
|
@@ -785,6 +789,7 @@ export declare const teamEndpoints: {
|
|
|
785
789
|
topRightRocketNear?: string | undefined;
|
|
786
790
|
totalPoints?: number | undefined;
|
|
787
791
|
};
|
|
792
|
+
yearOfCompetition: 2019;
|
|
788
793
|
} | {
|
|
789
794
|
red: {
|
|
790
795
|
adjustPoints?: number | undefined;
|
|
@@ -858,6 +863,7 @@ export declare const teamEndpoints: {
|
|
|
858
863
|
teleopPoints?: number | undefined;
|
|
859
864
|
totalPoints?: number | undefined;
|
|
860
865
|
};
|
|
866
|
+
yearOfCompetition: 2020;
|
|
861
867
|
} | {
|
|
862
868
|
red: {
|
|
863
869
|
adjustPoints?: number | undefined;
|
|
@@ -943,6 +949,7 @@ export declare const teamEndpoints: {
|
|
|
943
949
|
teleopPoints?: number | undefined;
|
|
944
950
|
totalPoints?: number | undefined;
|
|
945
951
|
};
|
|
952
|
+
yearOfCompetition: 2022;
|
|
946
953
|
} | {
|
|
947
954
|
red: {
|
|
948
955
|
activationBonusAchieved?: boolean | undefined;
|
|
@@ -1044,6 +1051,7 @@ export declare const teamEndpoints: {
|
|
|
1044
1051
|
totalChargeStationPoints?: number | undefined;
|
|
1045
1052
|
totalPoints?: number | undefined;
|
|
1046
1053
|
};
|
|
1054
|
+
yearOfCompetition: 2023;
|
|
1047
1055
|
} | {
|
|
1048
1056
|
red: {
|
|
1049
1057
|
adjustPoints?: number | undefined;
|
|
@@ -1153,6 +1161,7 @@ export declare const teamEndpoints: {
|
|
|
1153
1161
|
trapStageLeft?: boolean | undefined;
|
|
1154
1162
|
trapStageRight?: boolean | undefined;
|
|
1155
1163
|
};
|
|
1164
|
+
yearOfCompetition: 2024;
|
|
1156
1165
|
} | {
|
|
1157
1166
|
red: {
|
|
1158
1167
|
adjustPoints?: number | undefined;
|
|
@@ -1412,9 +1421,14 @@ export declare const teamEndpoints: {
|
|
|
1412
1421
|
totalPoints?: number | undefined;
|
|
1413
1422
|
wallAlgaeCount?: number | undefined;
|
|
1414
1423
|
};
|
|
1424
|
+
yearOfCompetition: 2025;
|
|
1415
1425
|
};
|
|
1416
1426
|
}[], {}>;
|
|
1417
1427
|
arguments: import("arktype/internal/methods/array.ts").ArrayType<[string, string], {}>;
|
|
1428
|
+
transformMatch: ({ key: eventKey }: {
|
|
1429
|
+
year?: number;
|
|
1430
|
+
key?: string;
|
|
1431
|
+
}, schema: unknown) => unknown;
|
|
1418
1432
|
};
|
|
1419
1433
|
"/team/{team_key}/event/{event_key}/matches/simple": {
|
|
1420
1434
|
schema: import("arktype/internal/methods/array.ts").ArrayType<{
|
|
@@ -1621,6 +1635,7 @@ export declare const teamEndpoints: {
|
|
|
1621
1635
|
};
|
|
1622
1636
|
coopertition: "None" | "Unknown" | "Stack";
|
|
1623
1637
|
coopertition_points: number;
|
|
1638
|
+
yearOfCompetition: 2015;
|
|
1624
1639
|
} | {
|
|
1625
1640
|
red: {
|
|
1626
1641
|
adjustPoints?: number | undefined;
|
|
@@ -1704,6 +1719,7 @@ export declare const teamEndpoints: {
|
|
|
1704
1719
|
towerFaceB?: string | undefined;
|
|
1705
1720
|
towerFaceC?: string | undefined;
|
|
1706
1721
|
};
|
|
1722
|
+
yearOfCompetition: 2016;
|
|
1707
1723
|
} | {
|
|
1708
1724
|
red: {
|
|
1709
1725
|
adjustPoints?: number | undefined;
|
|
@@ -1777,6 +1793,7 @@ export declare const teamEndpoints: {
|
|
|
1777
1793
|
touchpadMiddle?: string | undefined;
|
|
1778
1794
|
touchpadNear?: string | undefined;
|
|
1779
1795
|
};
|
|
1796
|
+
yearOfCompetition: 2017;
|
|
1780
1797
|
} | {
|
|
1781
1798
|
red: {
|
|
1782
1799
|
adjustPoints?: number | undefined;
|
|
@@ -1856,6 +1873,7 @@ export declare const teamEndpoints: {
|
|
|
1856
1873
|
vaultLevitateTotal?: number | undefined;
|
|
1857
1874
|
vaultPoints?: number | undefined;
|
|
1858
1875
|
};
|
|
1876
|
+
yearOfCompetition: 2018;
|
|
1859
1877
|
} | {
|
|
1860
1878
|
red: {
|
|
1861
1879
|
adjustPoints?: number | undefined;
|
|
@@ -1963,6 +1981,7 @@ export declare const teamEndpoints: {
|
|
|
1963
1981
|
topRightRocketNear?: string | undefined;
|
|
1964
1982
|
totalPoints?: number | undefined;
|
|
1965
1983
|
};
|
|
1984
|
+
yearOfCompetition: 2019;
|
|
1966
1985
|
} | {
|
|
1967
1986
|
red: {
|
|
1968
1987
|
adjustPoints?: number | undefined;
|
|
@@ -2036,6 +2055,7 @@ export declare const teamEndpoints: {
|
|
|
2036
2055
|
teleopPoints?: number | undefined;
|
|
2037
2056
|
totalPoints?: number | undefined;
|
|
2038
2057
|
};
|
|
2058
|
+
yearOfCompetition: 2020;
|
|
2039
2059
|
} | {
|
|
2040
2060
|
red: {
|
|
2041
2061
|
adjustPoints?: number | undefined;
|
|
@@ -2121,6 +2141,7 @@ export declare const teamEndpoints: {
|
|
|
2121
2141
|
teleopPoints?: number | undefined;
|
|
2122
2142
|
totalPoints?: number | undefined;
|
|
2123
2143
|
};
|
|
2144
|
+
yearOfCompetition: 2022;
|
|
2124
2145
|
} | {
|
|
2125
2146
|
red: {
|
|
2126
2147
|
activationBonusAchieved?: boolean | undefined;
|
|
@@ -2222,6 +2243,7 @@ export declare const teamEndpoints: {
|
|
|
2222
2243
|
totalChargeStationPoints?: number | undefined;
|
|
2223
2244
|
totalPoints?: number | undefined;
|
|
2224
2245
|
};
|
|
2246
|
+
yearOfCompetition: 2023;
|
|
2225
2247
|
} | {
|
|
2226
2248
|
red: {
|
|
2227
2249
|
adjustPoints?: number | undefined;
|
|
@@ -2331,6 +2353,7 @@ export declare const teamEndpoints: {
|
|
|
2331
2353
|
trapStageLeft?: boolean | undefined;
|
|
2332
2354
|
trapStageRight?: boolean | undefined;
|
|
2333
2355
|
};
|
|
2356
|
+
yearOfCompetition: 2024;
|
|
2334
2357
|
} | {
|
|
2335
2358
|
red: {
|
|
2336
2359
|
adjustPoints?: number | undefined;
|
|
@@ -2590,9 +2613,14 @@ export declare const teamEndpoints: {
|
|
|
2590
2613
|
totalPoints?: number | undefined;
|
|
2591
2614
|
wallAlgaeCount?: number | undefined;
|
|
2592
2615
|
};
|
|
2616
|
+
yearOfCompetition: 2025;
|
|
2593
2617
|
};
|
|
2594
2618
|
}[], {}>;
|
|
2595
2619
|
arguments: import("arktype/internal/methods/array.ts").ArrayType<[string, number], {}>;
|
|
2620
|
+
transformMatch: ({ year }: {
|
|
2621
|
+
year?: number;
|
|
2622
|
+
key?: string;
|
|
2623
|
+
}, schema: unknown) => unknown;
|
|
2596
2624
|
};
|
|
2597
2625
|
"/team/{team_key}/matches/{year}/simple": {
|
|
2598
2626
|
schema: import("arktype/internal/methods/array.ts").ArrayType<{
|
|
@@ -85,6 +85,17 @@ export const teamEndpoints = {
|
|
|
85
85
|
"/team/{team_key}/event/{event_key}/matches": {
|
|
86
86
|
schema: Match.array(),
|
|
87
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
|
+
},
|
|
88
99
|
},
|
|
89
100
|
"/team/{team_key}/event/{event_key}/matches/simple": {
|
|
90
101
|
schema: Match_Simple.array(),
|
|
@@ -113,6 +124,16 @@ export const teamEndpoints = {
|
|
|
113
124
|
"/team/{team_key}/matches/{year}": {
|
|
114
125
|
schema: Match.array(),
|
|
115
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
|
+
},
|
|
116
137
|
},
|
|
117
138
|
"/team/{team_key}/matches/{year}/simple": {
|
|
118
139
|
schema: Match_Simple.array(),
|
package/dist/types/index.d.ts
CHANGED
|
@@ -562,6 +562,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
562
562
|
};
|
|
563
563
|
coopertition: "None" | "Unknown" | "Stack";
|
|
564
564
|
coopertition_points: number;
|
|
565
|
+
yearOfCompetition: 2015;
|
|
565
566
|
}, {}>;
|
|
566
567
|
"2016": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
567
568
|
red: {
|
|
@@ -646,6 +647,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
646
647
|
towerFaceB?: string | undefined;
|
|
647
648
|
towerFaceC?: string | undefined;
|
|
648
649
|
};
|
|
650
|
+
yearOfCompetition: 2016;
|
|
649
651
|
}, {}>;
|
|
650
652
|
"2017": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
651
653
|
red: {
|
|
@@ -720,6 +722,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
720
722
|
touchpadMiddle?: string | undefined;
|
|
721
723
|
touchpadNear?: string | undefined;
|
|
722
724
|
};
|
|
725
|
+
yearOfCompetition: 2017;
|
|
723
726
|
}, {}>;
|
|
724
727
|
"2018": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
725
728
|
red: {
|
|
@@ -800,6 +803,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
800
803
|
vaultLevitateTotal?: number | undefined;
|
|
801
804
|
vaultPoints?: number | undefined;
|
|
802
805
|
};
|
|
806
|
+
yearOfCompetition: 2018;
|
|
803
807
|
}, {}>;
|
|
804
808
|
"2019": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
805
809
|
red: {
|
|
@@ -908,6 +912,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
908
912
|
topRightRocketNear?: string | undefined;
|
|
909
913
|
totalPoints?: number | undefined;
|
|
910
914
|
};
|
|
915
|
+
yearOfCompetition: 2019;
|
|
911
916
|
}, {}>;
|
|
912
917
|
"2020": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
913
918
|
red: {
|
|
@@ -982,6 +987,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
982
987
|
teleopPoints?: number | undefined;
|
|
983
988
|
totalPoints?: number | undefined;
|
|
984
989
|
};
|
|
990
|
+
yearOfCompetition: 2020;
|
|
985
991
|
}, {}>;
|
|
986
992
|
"2022": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
987
993
|
red: {
|
|
@@ -1068,6 +1074,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
1068
1074
|
teleopPoints?: number | undefined;
|
|
1069
1075
|
totalPoints?: number | undefined;
|
|
1070
1076
|
};
|
|
1077
|
+
yearOfCompetition: 2022;
|
|
1071
1078
|
}, {}>;
|
|
1072
1079
|
"2023": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
1073
1080
|
red: {
|
|
@@ -1170,6 +1177,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
1170
1177
|
totalChargeStationPoints?: number | undefined;
|
|
1171
1178
|
totalPoints?: number | undefined;
|
|
1172
1179
|
};
|
|
1180
|
+
yearOfCompetition: 2023;
|
|
1173
1181
|
}, {}>;
|
|
1174
1182
|
"2024": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
1175
1183
|
red: {
|
|
@@ -1280,6 +1288,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
1280
1288
|
trapStageLeft?: boolean | undefined;
|
|
1281
1289
|
trapStageRight?: boolean | undefined;
|
|
1282
1290
|
};
|
|
1291
|
+
yearOfCompetition: 2024;
|
|
1283
1292
|
}, {}>;
|
|
1284
1293
|
"2025": import("arktype/internal/methods/object.ts").ObjectType<{
|
|
1285
1294
|
red: {
|
|
@@ -1540,6 +1549,7 @@ export declare const matchScoreBreakdownYearsMatches: {
|
|
|
1540
1549
|
totalPoints?: number | undefined;
|
|
1541
1550
|
wallAlgaeCount?: number | undefined;
|
|
1542
1551
|
};
|
|
1552
|
+
yearOfCompetition: 2025;
|
|
1543
1553
|
}, {}>;
|
|
1544
1554
|
};
|
|
1545
1555
|
export declare const Match_alliance: import("arktype/internal/methods/object.ts").ObjectType<{
|
|
@@ -1656,6 +1666,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
1656
1666
|
};
|
|
1657
1667
|
coopertition: "None" | "Unknown" | "Stack";
|
|
1658
1668
|
coopertition_points: number;
|
|
1669
|
+
yearOfCompetition: 2015;
|
|
1659
1670
|
} | {
|
|
1660
1671
|
red: {
|
|
1661
1672
|
adjustPoints?: number | undefined;
|
|
@@ -1739,6 +1750,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
1739
1750
|
towerFaceB?: string | undefined;
|
|
1740
1751
|
towerFaceC?: string | undefined;
|
|
1741
1752
|
};
|
|
1753
|
+
yearOfCompetition: 2016;
|
|
1742
1754
|
} | {
|
|
1743
1755
|
red: {
|
|
1744
1756
|
adjustPoints?: number | undefined;
|
|
@@ -1812,6 +1824,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
1812
1824
|
touchpadMiddle?: string | undefined;
|
|
1813
1825
|
touchpadNear?: string | undefined;
|
|
1814
1826
|
};
|
|
1827
|
+
yearOfCompetition: 2017;
|
|
1815
1828
|
} | {
|
|
1816
1829
|
red: {
|
|
1817
1830
|
adjustPoints?: number | undefined;
|
|
@@ -1891,6 +1904,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
1891
1904
|
vaultLevitateTotal?: number | undefined;
|
|
1892
1905
|
vaultPoints?: number | undefined;
|
|
1893
1906
|
};
|
|
1907
|
+
yearOfCompetition: 2018;
|
|
1894
1908
|
} | {
|
|
1895
1909
|
red: {
|
|
1896
1910
|
adjustPoints?: number | undefined;
|
|
@@ -1998,6 +2012,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
1998
2012
|
topRightRocketNear?: string | undefined;
|
|
1999
2013
|
totalPoints?: number | undefined;
|
|
2000
2014
|
};
|
|
2015
|
+
yearOfCompetition: 2019;
|
|
2001
2016
|
} | {
|
|
2002
2017
|
red: {
|
|
2003
2018
|
adjustPoints?: number | undefined;
|
|
@@ -2071,6 +2086,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2071
2086
|
teleopPoints?: number | undefined;
|
|
2072
2087
|
totalPoints?: number | undefined;
|
|
2073
2088
|
};
|
|
2089
|
+
yearOfCompetition: 2020;
|
|
2074
2090
|
} | {
|
|
2075
2091
|
red: {
|
|
2076
2092
|
adjustPoints?: number | undefined;
|
|
@@ -2156,6 +2172,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2156
2172
|
teleopPoints?: number | undefined;
|
|
2157
2173
|
totalPoints?: number | undefined;
|
|
2158
2174
|
};
|
|
2175
|
+
yearOfCompetition: 2022;
|
|
2159
2176
|
} | {
|
|
2160
2177
|
red: {
|
|
2161
2178
|
activationBonusAchieved?: boolean | undefined;
|
|
@@ -2257,6 +2274,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2257
2274
|
totalChargeStationPoints?: number | undefined;
|
|
2258
2275
|
totalPoints?: number | undefined;
|
|
2259
2276
|
};
|
|
2277
|
+
yearOfCompetition: 2023;
|
|
2260
2278
|
} | {
|
|
2261
2279
|
red: {
|
|
2262
2280
|
adjustPoints?: number | undefined;
|
|
@@ -2366,6 +2384,7 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2366
2384
|
trapStageLeft?: boolean | undefined;
|
|
2367
2385
|
trapStageRight?: boolean | undefined;
|
|
2368
2386
|
};
|
|
2387
|
+
yearOfCompetition: 2024;
|
|
2369
2388
|
} | {
|
|
2370
2389
|
red: {
|
|
2371
2390
|
adjustPoints?: number | undefined;
|
|
@@ -2625,5 +2644,6 @@ export declare const Match: import("arktype/internal/methods/object.ts").ObjectT
|
|
|
2625
2644
|
totalPoints?: number | undefined;
|
|
2626
2645
|
wallAlgaeCount?: number | undefined;
|
|
2627
2646
|
};
|
|
2647
|
+
yearOfCompetition: 2025;
|
|
2628
2648
|
};
|
|
2629
2649
|
}, {}>;
|
|
@@ -467,42 +467,52 @@ export const matchScoreBreakdownYearsMatches = {
|
|
|
467
467
|
blue: matchScoreBreakdownYearsAlliances["2015"],
|
|
468
468
|
coopertition: "'None' | 'Unknown' | 'Stack'",
|
|
469
469
|
coopertition_points: "number",
|
|
470
|
+
yearOfCompetition: "2015",
|
|
470
471
|
}),
|
|
471
472
|
"2016": type({
|
|
472
473
|
red: matchScoreBreakdownYearsAlliances["2016"],
|
|
473
474
|
blue: matchScoreBreakdownYearsAlliances["2016"],
|
|
475
|
+
yearOfCompetition: "2016",
|
|
474
476
|
}),
|
|
475
477
|
"2017": type({
|
|
476
478
|
red: matchScoreBreakdownYearsAlliances["2017"],
|
|
477
479
|
blue: matchScoreBreakdownYearsAlliances["2017"],
|
|
480
|
+
yearOfCompetition: "2017",
|
|
478
481
|
}),
|
|
479
482
|
"2018": type({
|
|
480
483
|
red: matchScoreBreakdownYearsAlliances["2018"],
|
|
481
484
|
blue: matchScoreBreakdownYearsAlliances["2018"],
|
|
485
|
+
yearOfCompetition: "2018",
|
|
482
486
|
}),
|
|
483
487
|
"2019": type({
|
|
484
488
|
red: matchScoreBreakdownYearsAlliances["2019"],
|
|
485
489
|
blue: matchScoreBreakdownYearsAlliances["2019"],
|
|
490
|
+
yearOfCompetition: "2019",
|
|
486
491
|
}),
|
|
487
492
|
"2020": type({
|
|
488
493
|
red: matchScoreBreakdownYearsAlliances["2020"],
|
|
489
494
|
blue: matchScoreBreakdownYearsAlliances["2020"],
|
|
495
|
+
yearOfCompetition: "2020",
|
|
490
496
|
}),
|
|
491
497
|
"2022": type({
|
|
492
498
|
red: matchScoreBreakdownYearsAlliances["2022"],
|
|
493
499
|
blue: matchScoreBreakdownYearsAlliances["2022"],
|
|
500
|
+
yearOfCompetition: "2022",
|
|
494
501
|
}),
|
|
495
502
|
"2023": type({
|
|
496
503
|
red: matchScoreBreakdownYearsAlliances["2023"],
|
|
497
504
|
blue: matchScoreBreakdownYearsAlliances["2023"],
|
|
505
|
+
yearOfCompetition: "2023",
|
|
498
506
|
}),
|
|
499
507
|
"2024": type({
|
|
500
508
|
red: matchScoreBreakdownYearsAlliances["2024"],
|
|
501
509
|
blue: matchScoreBreakdownYearsAlliances["2024"],
|
|
510
|
+
yearOfCompetition: "2024",
|
|
502
511
|
}),
|
|
503
512
|
"2025": type({
|
|
504
513
|
red: matchScoreBreakdownYearsAlliances["2025"],
|
|
505
514
|
blue: matchScoreBreakdownYearsAlliances["2025"],
|
|
515
|
+
yearOfCompetition: "2025",
|
|
506
516
|
}),
|
|
507
517
|
};
|
|
508
518
|
const msb = matchScoreBreakdownYearsMatches;
|