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,52 @@
1
+ export declare const Team_Simple: import("arktype/internal/methods/object.ts").ObjectType<{
2
+ key: string;
3
+ team_number: number;
4
+ nickname: string;
5
+ name: string;
6
+ city: string | null;
7
+ state_prov: string | null;
8
+ country: string | null;
9
+ }, {}>;
10
+ export declare const Team: import("arktype/internal/methods/object.ts").ObjectType<{
11
+ key: string;
12
+ team_number: number;
13
+ nickname: string;
14
+ name: string;
15
+ city: string | null;
16
+ state_prov: string | null;
17
+ country: string | null;
18
+ postal_code: string | null;
19
+ rookie_year: number | null;
20
+ website?: string | null | undefined;
21
+ }, {}>;
22
+ export declare const Award_Recipient: import("arktype/internal/methods/object.ts").ObjectType<{
23
+ team_key: string | null;
24
+ awardee: string | null;
25
+ }, {}>;
26
+ export declare const Award: import("arktype/internal/methods/object.ts").ObjectType<{
27
+ name: string;
28
+ award_type: number;
29
+ event_key: string;
30
+ recipient_list: {
31
+ team_key: string | null;
32
+ awardee: string | null;
33
+ }[];
34
+ year: number;
35
+ }, {}>;
36
+ export declare const Team_Robot: import("arktype/internal/methods/object.ts").ObjectType<{
37
+ year: number;
38
+ robot_name: string;
39
+ key: string;
40
+ team_key: string;
41
+ }, {}>;
42
+ export declare const Media: import("arktype/internal/methods/object.ts").ObjectType<{
43
+ type: string;
44
+ foreign_key: string;
45
+ team_keys: string[];
46
+ details?: {
47
+ [x: string]: unknown;
48
+ } | undefined;
49
+ preferred?: boolean | undefined;
50
+ direct_url?: string | undefined;
51
+ view_url?: string | undefined;
52
+ }, {}>;
@@ -0,0 +1,41 @@
1
+ import { type } from "arktype";
2
+ export const Team_Simple = type({
3
+ key: "string",
4
+ team_number: "number",
5
+ nickname: "string",
6
+ name: "string",
7
+ city: "string | null",
8
+ state_prov: "string | null",
9
+ country: "string | null",
10
+ });
11
+ export const Team = Team_Simple.and({
12
+ postal_code: "string | null",
13
+ "website?": "string | null",
14
+ rookie_year: "number | null",
15
+ });
16
+ export const Award_Recipient = type({
17
+ team_key: "string | null",
18
+ awardee: "string | null",
19
+ });
20
+ export const Award = type({
21
+ name: "string",
22
+ award_type: "number",
23
+ event_key: "string",
24
+ recipient_list: Award_Recipient.array(),
25
+ year: "number",
26
+ });
27
+ export const Team_Robot = type({
28
+ year: "number",
29
+ robot_name: "string",
30
+ key: "string",
31
+ team_key: "string",
32
+ });
33
+ export const Media = type({
34
+ type: "string",
35
+ foreign_key: "string",
36
+ "details?": type({ "[string]": "unknown" }),
37
+ preferred: "boolean?",
38
+ team_keys: "string[]",
39
+ direct_url: "string?",
40
+ view_url: "string?",
41
+ });
@@ -0,0 +1,11 @@
1
+ type Success<T> = {
2
+ data: T;
3
+ error: null;
4
+ };
5
+ type Failure<E> = {
6
+ data: null;
7
+ error: E;
8
+ };
9
+ export type Result<T, E = Error> = Success<T> | Failure<E>;
10
+ export declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
11
+ export {};
package/dist/utils.js ADDED
@@ -0,0 +1,9 @@
1
+ export async function tryCatch(promise) {
2
+ try {
3
+ const data = await promise;
4
+ return { data, error: null };
5
+ }
6
+ catch (error) {
7
+ return { data: null, error: error };
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tbarequest",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A wrapper to fetch data from The Blue Alliance API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",