@btrc/contracts 0.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.
@@ -0,0 +1,248 @@
1
+ import { z } from 'zod';
2
+ export declare const PageQuerySchema: z.ZodObject<{
3
+ cursor: z.ZodOptional<z.ZodString>;
4
+ limit: z.ZodDefault<z.ZodNumber>;
5
+ sort: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ cursor?: string | undefined;
8
+ limit: number;
9
+ sort?: string | undefined;
10
+ }, {
11
+ cursor?: string | undefined;
12
+ limit?: number | undefined;
13
+ sort?: string | undefined;
14
+ }>;
15
+ export declare const PublicListQuerySchema: z.ZodObject<{
16
+ cursor: z.ZodOptional<z.ZodString>;
17
+ limit: z.ZodDefault<z.ZodNumber>;
18
+ sort: z.ZodOptional<z.ZodString>;
19
+ } & {
20
+ event_id: z.ZodOptional<z.ZodBranded<z.ZodString, "EventId">>;
21
+ session_id: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
22
+ driver_id: z.ZodOptional<z.ZodBranded<z.ZodString, "DriverId">>;
23
+ entry_id: z.ZodOptional<z.ZodBranded<z.ZodString, "EntryId">>;
24
+ status: z.ZodOptional<z.ZodString>;
25
+ type: z.ZodOptional<z.ZodString>;
26
+ current_only: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ cursor?: string | undefined;
29
+ limit: number;
30
+ sort?: string | undefined;
31
+ event_id?: (string & z.BRAND<"EventId">) | undefined;
32
+ session_id?: (string & z.BRAND<"SessionId">) | undefined;
33
+ driver_id?: (string & z.BRAND<"DriverId">) | undefined;
34
+ entry_id?: (string & z.BRAND<"EntryId">) | undefined;
35
+ status?: string | undefined;
36
+ type?: string | undefined;
37
+ current_only: boolean;
38
+ }, {
39
+ cursor?: string | undefined;
40
+ limit?: number | undefined;
41
+ sort?: string | undefined;
42
+ event_id?: string | undefined;
43
+ session_id?: string | undefined;
44
+ driver_id?: string | undefined;
45
+ entry_id?: string | undefined;
46
+ status?: string | undefined;
47
+ type?: string | undefined;
48
+ current_only?: unknown;
49
+ }>;
50
+ export declare const EventListQuerySchema: z.ZodObject<{
51
+ cursor: z.ZodOptional<z.ZodString>;
52
+ limit: z.ZodDefault<z.ZodNumber>;
53
+ sort: z.ZodOptional<z.ZodString>;
54
+ } & {
55
+ season: z.ZodOptional<z.ZodNumber>;
56
+ championship_id: z.ZodOptional<z.ZodBranded<z.ZodString, "ChampionshipId">>;
57
+ circuit_id: z.ZodOptional<z.ZodBranded<z.ZodString, "CircuitId">>;
58
+ status: z.ZodOptional<z.ZodEnum<["scheduled", "completed", "cancelled", "provisional"]>>;
59
+ date_from: z.ZodOptional<z.ZodString>;
60
+ date_to: z.ZodOptional<z.ZodString>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ cursor?: string | undefined;
63
+ limit: number;
64
+ sort?: string | undefined;
65
+ season?: number | undefined;
66
+ championship_id?: (string & z.BRAND<"ChampionshipId">) | undefined;
67
+ circuit_id?: (string & z.BRAND<"CircuitId">) | undefined;
68
+ status?: "cancelled" | "completed" | "provisional" | "scheduled" | undefined;
69
+ date_from?: string | undefined;
70
+ date_to?: string | undefined;
71
+ }, {
72
+ cursor?: string | undefined;
73
+ limit?: number | undefined;
74
+ sort?: string | undefined;
75
+ season?: number | undefined;
76
+ championship_id?: string | undefined;
77
+ circuit_id?: string | undefined;
78
+ status?: "cancelled" | "completed" | "provisional" | "scheduled" | undefined;
79
+ date_from?: string | undefined;
80
+ date_to?: string | undefined;
81
+ }>;
82
+ export declare const SessionListQuerySchema: z.ZodObject<{
83
+ cursor: z.ZodOptional<z.ZodString>;
84
+ limit: z.ZodDefault<z.ZodNumber>;
85
+ sort: z.ZodOptional<z.ZodString>;
86
+ } & {
87
+ event_id: z.ZodOptional<z.ZodBranded<z.ZodString, "EventId">>;
88
+ season: z.ZodOptional<z.ZodNumber>;
89
+ type: z.ZodOptional<z.ZodEnum<["practice", "qualifying", "warmup", "race", "test", "other"]>>;
90
+ status: z.ZodOptional<z.ZodEnum<["scheduled", "provisional", "official", "cancelled", "abandoned"]>>;
91
+ publication_version: z.ZodOptional<z.ZodString>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ cursor?: string | undefined;
94
+ limit: number;
95
+ sort?: string | undefined;
96
+ event_id?: (string & z.BRAND<"EventId">) | undefined;
97
+ season?: number | undefined;
98
+ type?: "other" | "practice" | "qualifying" | "race" | "test" | "warmup" | undefined;
99
+ status?: "abandoned" | "cancelled" | "official" | "provisional" | "scheduled" | undefined;
100
+ publication_version?: string | undefined;
101
+ }, {
102
+ cursor?: string | undefined;
103
+ limit?: number | undefined;
104
+ sort?: string | undefined;
105
+ event_id?: string | undefined;
106
+ season?: number | undefined;
107
+ type?: "other" | "practice" | "qualifying" | "race" | "test" | "warmup" | undefined;
108
+ status?: "abandoned" | "cancelled" | "official" | "provisional" | "scheduled" | undefined;
109
+ publication_version?: string | undefined;
110
+ }>;
111
+ export declare const LapListQuerySchema: z.ZodObject<{
112
+ cursor: z.ZodOptional<z.ZodString>;
113
+ limit: z.ZodDefault<z.ZodNumber>;
114
+ sort: z.ZodOptional<z.ZodString>;
115
+ } & {
116
+ session_id: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
117
+ driver_id: z.ZodOptional<z.ZodBranded<z.ZodString, "DriverId">>;
118
+ entry_id: z.ZodOptional<z.ZodBranded<z.ZodString, "EntryId">>;
119
+ race_number: z.ZodOptional<z.ZodString>;
120
+ lap_from: z.ZodOptional<z.ZodNumber>;
121
+ lap_to: z.ZodOptional<z.ZodNumber>;
122
+ valid_only: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
123
+ include_disallowed: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
124
+ include_pit_laps: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
125
+ min_time_ms: z.ZodOptional<z.ZodNumber>;
126
+ max_time_ms: z.ZodOptional<z.ZodNumber>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ cursor?: string | undefined;
129
+ limit: number;
130
+ sort?: string | undefined;
131
+ session_id?: (string & z.BRAND<"SessionId">) | undefined;
132
+ driver_id?: (string & z.BRAND<"DriverId">) | undefined;
133
+ entry_id?: (string & z.BRAND<"EntryId">) | undefined;
134
+ race_number?: string | undefined;
135
+ lap_from?: number | undefined;
136
+ lap_to?: number | undefined;
137
+ valid_only: boolean;
138
+ include_disallowed: boolean;
139
+ include_pit_laps: boolean;
140
+ min_time_ms?: number | undefined;
141
+ max_time_ms?: number | undefined;
142
+ }, {
143
+ cursor?: string | undefined;
144
+ limit?: number | undefined;
145
+ sort?: string | undefined;
146
+ session_id?: string | undefined;
147
+ driver_id?: string | undefined;
148
+ entry_id?: string | undefined;
149
+ race_number?: string | undefined;
150
+ lap_from?: number | undefined;
151
+ lap_to?: number | undefined;
152
+ valid_only?: unknown;
153
+ include_disallowed?: unknown;
154
+ include_pit_laps?: unknown;
155
+ min_time_ms?: number | undefined;
156
+ max_time_ms?: number | undefined;
157
+ }>;
158
+ export declare const SearchQuerySchema: z.ZodObject<{
159
+ q: z.ZodString;
160
+ limit: z.ZodDefault<z.ZodNumber>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ q: string;
163
+ limit: number;
164
+ }, {
165
+ q: string;
166
+ limit?: number | undefined;
167
+ }>;
168
+ export declare const LeaderboardQuerySchema: z.ZodObject<{
169
+ cursor: z.ZodOptional<z.ZodString>;
170
+ limit: z.ZodDefault<z.ZodNumber>;
171
+ sort: z.ZodOptional<z.ZodString>;
172
+ } & {
173
+ season: z.ZodOptional<z.ZodNumber>;
174
+ circuit_id: z.ZodOptional<z.ZodBranded<z.ZodString, "CircuitId">>;
175
+ layout_id: z.ZodOptional<z.ZodBranded<z.ZodString, "CircuitLayoutId">>;
176
+ class: z.ZodOptional<z.ZodEnum<["class-1", "class-2"]>>;
177
+ session_type: z.ZodOptional<z.ZodEnum<["practice", "qualifying", "warmup", "race", "test", "other"]>>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ cursor?: string | undefined;
180
+ limit: number;
181
+ sort?: string | undefined;
182
+ season?: number | undefined;
183
+ circuit_id?: (string & z.BRAND<"CircuitId">) | undefined;
184
+ layout_id?: (string & z.BRAND<"CircuitLayoutId">) | undefined;
185
+ class?: "class-1" | "class-2" | undefined;
186
+ session_type?: "other" | "practice" | "qualifying" | "race" | "test" | "warmup" | undefined;
187
+ }, {
188
+ cursor?: string | undefined;
189
+ limit?: number | undefined;
190
+ sort?: string | undefined;
191
+ season?: number | undefined;
192
+ circuit_id?: string | undefined;
193
+ layout_id?: string | undefined;
194
+ class?: "class-1" | "class-2" | undefined;
195
+ session_type?: "other" | "practice" | "qualifying" | "race" | "test" | "warmup" | undefined;
196
+ }>;
197
+ export declare const DriverListQuerySchema: z.ZodObject<{
198
+ cursor: z.ZodOptional<z.ZodString>;
199
+ limit: z.ZodDefault<z.ZodNumber>;
200
+ sort: z.ZodOptional<z.ZodString>;
201
+ } & {
202
+ q: z.ZodOptional<z.ZodString>;
203
+ season: z.ZodOptional<z.ZodNumber>;
204
+ class: z.ZodOptional<z.ZodEnum<["class-1", "class-2"]>>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ cursor?: string | undefined;
207
+ limit: number;
208
+ sort?: string | undefined;
209
+ q?: string | undefined;
210
+ season?: number | undefined;
211
+ class?: "class-1" | "class-2" | undefined;
212
+ }, {
213
+ cursor?: string | undefined;
214
+ limit?: number | undefined;
215
+ sort?: string | undefined;
216
+ q?: string | undefined;
217
+ season?: number | undefined;
218
+ class?: "class-1" | "class-2" | undefined;
219
+ }>;
220
+ export declare const StandingsQuerySchema: z.ZodObject<{
221
+ class: z.ZodOptional<z.ZodEnum<["class-1", "class-2"]>>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ class?: "class-1" | "class-2" | undefined;
224
+ }, {
225
+ class?: "class-1" | "class-2" | undefined;
226
+ }>;
227
+ export declare const DatasetDownloadQuerySchema: z.ZodObject<{
228
+ format: z.ZodDefault<z.ZodEnum<["csv", "jsonl"]>>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ format: "csv" | "jsonl";
231
+ }, {
232
+ format?: "csv" | "jsonl" | undefined;
233
+ }>;
234
+ export declare const ComparisonQuerySchema: z.ZodObject<{
235
+ ids: z.ZodPipeline<z.ZodEffects<z.ZodString, string[], string>, z.ZodArray<z.ZodString, "many">>;
236
+ session_id: z.ZodOptional<z.ZodBranded<z.ZodString, "SessionId">>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ ids: string[];
239
+ session_id?: (string & z.BRAND<"SessionId">) | undefined;
240
+ }, {
241
+ ids: string;
242
+ session_id?: string | undefined;
243
+ }>;
244
+ export type PageQuery = z.infer<typeof PageQuerySchema>;
245
+ export type EventListQuery = z.infer<typeof EventListQuerySchema>;
246
+ export type SessionListQuery = z.infer<typeof SessionListQuerySchema>;
247
+ export type LapListQuery = z.infer<typeof LapListQuerySchema>;
248
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;EAIhC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;EAErC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ import { ChampionshipId, CircuitId, CircuitLayoutId, DriverId, EntryId, EventId, Id, IsoDate, PublicationVersionSchema, QueryBoolean, SessionId, } from './primitives.js';
3
+ import { EventStatusSchema, SessionStatusSchema, SessionTypeSchema } from './resources.js';
4
+ export const PageQuerySchema = z.object({
5
+ cursor: z.string().min(1).optional(),
6
+ limit: z.coerce.number().int().min(1).max(200).default(50),
7
+ sort: z.string().max(80).optional(),
8
+ });
9
+ export const PublicListQuerySchema = PageQuerySchema.extend({
10
+ event_id: EventId.optional(), session_id: SessionId.optional(), driver_id: DriverId.optional(), entry_id: EntryId.optional(),
11
+ status: z.string().max(80).optional(), type: z.string().max(80).optional(), current_only: QueryBoolean.default(true),
12
+ });
13
+ export const EventListQuerySchema = PageQuerySchema.extend({
14
+ season: z.coerce.number().int().min(1900).max(2200).optional(),
15
+ championship_id: ChampionshipId.optional(),
16
+ circuit_id: CircuitId.optional(),
17
+ status: EventStatusSchema.optional(),
18
+ date_from: IsoDate.optional(),
19
+ date_to: IsoDate.optional(),
20
+ });
21
+ export const SessionListQuerySchema = PageQuerySchema.extend({
22
+ event_id: EventId.optional(),
23
+ season: z.coerce.number().int().min(1900).max(2200).optional(),
24
+ type: SessionTypeSchema.optional(),
25
+ status: SessionStatusSchema.optional(),
26
+ publication_version: PublicationVersionSchema.optional(),
27
+ });
28
+ export const LapListQuerySchema = PageQuerySchema.extend({
29
+ session_id: SessionId.optional(),
30
+ driver_id: DriverId.optional(),
31
+ entry_id: EntryId.optional(),
32
+ race_number: z.string().max(20).optional(),
33
+ lap_from: z.coerce.number().int().nonnegative().optional(),
34
+ lap_to: z.coerce.number().int().nonnegative().optional(),
35
+ valid_only: QueryBoolean.default(false),
36
+ include_disallowed: QueryBoolean.default(false),
37
+ include_pit_laps: QueryBoolean.default(false),
38
+ min_time_ms: z.coerce.number().int().nonnegative().optional(),
39
+ max_time_ms: z.coerce.number().int().nonnegative().optional(),
40
+ });
41
+ export const SearchQuerySchema = z.object({
42
+ q: z.string().trim().min(2).max(100),
43
+ limit: z.coerce.number().int().min(1).max(50).default(20),
44
+ });
45
+ export const LeaderboardQuerySchema = PageQuerySchema.extend({
46
+ season: z.coerce.number().int().min(1900).max(2200).optional(),
47
+ circuit_id: CircuitId.optional(),
48
+ layout_id: CircuitLayoutId.optional(),
49
+ class: z.enum(['class-1', 'class-2']).optional(),
50
+ session_type: SessionTypeSchema.optional(),
51
+ });
52
+ export const DriverListQuerySchema = PageQuerySchema.extend({
53
+ q: z.string().trim().min(1).max(100).optional(),
54
+ season: z.coerce.number().int().optional(),
55
+ class: z.enum(['class-1', 'class-2']).optional(),
56
+ });
57
+ export const StandingsQuerySchema = z.object({
58
+ class: z.enum(['class-1', 'class-2']).optional(),
59
+ });
60
+ export const DatasetDownloadQuerySchema = z.object({
61
+ format: z.enum(['csv', 'jsonl']).default('jsonl'),
62
+ });
63
+ export const ComparisonQuerySchema = z.object({
64
+ ids: z.string().transform((value) => value.split(',').map((part) => part.trim()).filter(Boolean)).pipe(z.array(Id).min(2).max(10)),
65
+ session_id: SessionId.optional(),
66
+ });