@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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bowler Racing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @btrc/contracts
2
+
3
+ Zod schemas, inferred TypeScript types, and route definitions for the Bowler Racing BTRC API — the single source of truth shared by the API server, [`@btrc/api-server`](https://www.npmjs.com/package/@btrc/api-server), and [`@btrc/api-client`](https://www.npmjs.com/package/@btrc/api-client).
4
+
5
+ ```bash
6
+ npm install @btrc/contracts
7
+ ```
8
+
9
+ ## What's inside
10
+
11
+ - **Resource schemas** — `DriverSchema`, `SessionSchema`, `LapSchema`, `JudicialDecisionSchema`, and ~40 more, all Zod with inferred types.
12
+ - **Envelopes** — `responseSchema(x)` / `pageSchema(x)` matching the API's `{ data, meta, links }` shape, plus `ProblemDetailsSchema` for RFC 9457 errors.
13
+ - **Query schemas** — `PageQuerySchema`, `LapListQuerySchema`, `LeaderboardQuerySchema`, etc., with the same defaults the server applies.
14
+ - **Route table** — `routes`: all 147 GET endpoints across 20 namespaces, each with path template, query schema, response envelope, and pagination flag. Import from `@btrc/contracts/routes` or the root.
15
+ - `API_VERSION` — the API spec version this package was generated against.
16
+
17
+ ```ts
18
+ import { routes, DriverSchema, type Driver } from '@btrc/contracts';
19
+
20
+ routes.drivers.get.path; // '/drivers/{driverId}'
21
+ const driver: Driver = DriverSchema.parse(json);
22
+ ```
23
+
24
+ Most consumers want [`@btrc/api-server`](https://www.npmjs.com/package/@btrc/api-server) (Node/SSR client) or [`@btrc/api-client`](https://www.npmjs.com/package/@btrc/api-client) (browser + React hooks) instead of using this package directly.
@@ -0,0 +1,205 @@
1
+ import { z } from 'zod';
2
+ export declare const ProblemDetailsSchema: z.ZodObject<{
3
+ type: z.ZodString;
4
+ title: z.ZodString;
5
+ status: z.ZodNumber;
6
+ detail: z.ZodString;
7
+ instance: z.ZodString;
8
+ requestId: z.ZodString;
9
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
10
+ path: z.ZodString;
11
+ message: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ path: string;
14
+ message: string;
15
+ }, {
16
+ path: string;
17
+ message: string;
18
+ }>, "many">>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ type: string;
21
+ title: string;
22
+ status: number;
23
+ detail: string;
24
+ instance: string;
25
+ requestId: string;
26
+ errors?: {
27
+ path: string;
28
+ message: string;
29
+ }[] | undefined;
30
+ }, {
31
+ type: string;
32
+ title: string;
33
+ status: number;
34
+ detail: string;
35
+ instance: string;
36
+ requestId: string;
37
+ errors?: {
38
+ path: string;
39
+ message: string;
40
+ }[] | undefined;
41
+ }>;
42
+ export type ProblemDetails = z.infer<typeof ProblemDetailsSchema>;
43
+ export declare const PageMetaSchema: z.ZodObject<{
44
+ requestId: z.ZodString;
45
+ asOf: z.ZodString;
46
+ hasMore: z.ZodBoolean;
47
+ nextCursor: z.ZodNullable<z.ZodString>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ requestId: string;
50
+ asOf: string;
51
+ hasMore: boolean;
52
+ nextCursor: string | null;
53
+ }, {
54
+ requestId: string;
55
+ asOf: string;
56
+ hasMore: boolean;
57
+ nextCursor: string | null;
58
+ }>;
59
+ export declare const LinksSchema: z.ZodObject<{
60
+ self: z.ZodString;
61
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ self: string;
64
+ next?: string | null | undefined;
65
+ }, {
66
+ self: string;
67
+ next?: string | null | undefined;
68
+ }>;
69
+ export declare function responseSchema<T extends z.ZodTypeAny>(data: T): z.ZodObject<{
70
+ data: T;
71
+ meta: z.ZodObject<{
72
+ requestId: z.ZodString;
73
+ asOf: z.ZodString;
74
+ }, "strip", z.ZodTypeAny, {
75
+ requestId: string;
76
+ asOf: string;
77
+ }, {
78
+ requestId: string;
79
+ asOf: string;
80
+ }>;
81
+ links: z.ZodObject<{
82
+ self: z.ZodString;
83
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ self: string;
86
+ next?: string | null | undefined;
87
+ }, {
88
+ self: string;
89
+ next?: string | null | undefined;
90
+ }>;
91
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
92
+ data: T;
93
+ meta: z.ZodObject<{
94
+ requestId: z.ZodString;
95
+ asOf: z.ZodString;
96
+ }, "strip", z.ZodTypeAny, {
97
+ requestId: string;
98
+ asOf: string;
99
+ }, {
100
+ requestId: string;
101
+ asOf: string;
102
+ }>;
103
+ links: z.ZodObject<{
104
+ self: z.ZodString;
105
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ self: string;
108
+ next?: string | null | undefined;
109
+ }, {
110
+ self: string;
111
+ next?: string | null | undefined;
112
+ }>;
113
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
114
+ data: T;
115
+ meta: z.ZodObject<{
116
+ requestId: z.ZodString;
117
+ asOf: z.ZodString;
118
+ }, "strip", z.ZodTypeAny, {
119
+ requestId: string;
120
+ asOf: string;
121
+ }, {
122
+ requestId: string;
123
+ asOf: string;
124
+ }>;
125
+ links: z.ZodObject<{
126
+ self: z.ZodString;
127
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ self: string;
130
+ next?: string | null | undefined;
131
+ }, {
132
+ self: string;
133
+ next?: string | null | undefined;
134
+ }>;
135
+ }> extends infer T_2 ? { [k in keyof T_2]: T_2[k]; } : never>;
136
+ export declare function pageSchema<T extends z.ZodTypeAny>(item: T): z.ZodObject<{
137
+ data: z.ZodArray<T, "many">;
138
+ meta: z.ZodObject<{
139
+ requestId: z.ZodString;
140
+ asOf: z.ZodString;
141
+ hasMore: z.ZodBoolean;
142
+ nextCursor: z.ZodNullable<z.ZodString>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ requestId: string;
145
+ asOf: string;
146
+ hasMore: boolean;
147
+ nextCursor: string | null;
148
+ }, {
149
+ requestId: string;
150
+ asOf: string;
151
+ hasMore: boolean;
152
+ nextCursor: string | null;
153
+ }>;
154
+ links: z.ZodObject<{
155
+ self: z.ZodString;
156
+ next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ self: string;
159
+ next?: string | null | undefined;
160
+ }, {
161
+ self: string;
162
+ next?: string | null | undefined;
163
+ }>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ data: T["_output"][];
166
+ meta: {
167
+ requestId: string;
168
+ asOf: string;
169
+ hasMore: boolean;
170
+ nextCursor: string | null;
171
+ };
172
+ links: {
173
+ self: string;
174
+ next?: string | null | undefined;
175
+ };
176
+ }, {
177
+ data: T["_input"][];
178
+ meta: {
179
+ requestId: string;
180
+ asOf: string;
181
+ hasMore: boolean;
182
+ nextCursor: string | null;
183
+ };
184
+ links: {
185
+ self: string;
186
+ next?: string | null | undefined;
187
+ };
188
+ }>;
189
+ export type ApiResponse<T> = {
190
+ data: T;
191
+ meta: {
192
+ requestId: string;
193
+ asOf: string;
194
+ };
195
+ links: {
196
+ self: string;
197
+ next?: string | null;
198
+ };
199
+ };
200
+ export type CursorPage<T> = {
201
+ data: T[];
202
+ meta: z.infer<typeof PageMetaSchema>;
203
+ links: z.infer<typeof LinksSchema>;
204
+ };
205
+ //# sourceMappingURL=envelopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelopes.d.ts","sourceRoot":"","sources":["../src/envelopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAM7D;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMzD;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAC3B,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;CACpC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { IsoDateTime } from './primitives.js';
3
+ export const ProblemDetailsSchema = z.object({
4
+ type: z.string().url(),
5
+ title: z.string(),
6
+ status: z.number().int().min(400).max(599),
7
+ detail: z.string(),
8
+ instance: z.string(),
9
+ requestId: z.string(),
10
+ errors: z.array(z.object({ path: z.string(), message: z.string() })).optional(),
11
+ });
12
+ export const PageMetaSchema = z.object({
13
+ requestId: z.string(),
14
+ asOf: IsoDateTime,
15
+ hasMore: z.boolean(),
16
+ nextCursor: z.string().nullable(),
17
+ });
18
+ export const LinksSchema = z.object({
19
+ self: z.string(),
20
+ next: z.string().nullable().optional(),
21
+ });
22
+ export function responseSchema(data) {
23
+ return z.object({
24
+ data,
25
+ meta: z.object({ requestId: z.string(), asOf: IsoDateTime }),
26
+ links: LinksSchema,
27
+ });
28
+ }
29
+ export function pageSchema(item) {
30
+ return z.object({
31
+ data: z.array(item),
32
+ meta: PageMetaSchema,
33
+ links: LinksSchema,
34
+ });
35
+ }
@@ -0,0 +1,7 @@
1
+ export * from './version.js';
2
+ export * from './primitives.js';
3
+ export * from './envelopes.js';
4
+ export * from './resources.js';
5
+ export * from './queries.js';
6
+ export * from './routes.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './version.js';
2
+ export * from './primitives.js';
3
+ export * from './envelopes.js';
4
+ export * from './resources.js';
5
+ export * from './queries.js';
6
+ export * from './routes.js';
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ export declare const Id: z.ZodString;
3
+ export declare const Uuid: z.ZodString;
4
+ export declare const IsoDate: z.ZodString;
5
+ export declare const IsoDateTime: z.ZodString;
6
+ export declare const NullableText: z.ZodNullable<z.ZodString>;
7
+ export declare const NullableNumber: z.ZodNullable<z.ZodNumber>;
8
+ export declare const QueryBoolean: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
9
+ export declare const PublicJsonValue: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
10
+ export declare const PublicJson: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
11
+ export declare const ChampionshipId: z.ZodBranded<z.ZodString, "ChampionshipId">;
12
+ export declare const CircuitId: z.ZodBranded<z.ZodString, "CircuitId">;
13
+ export declare const CircuitLayoutId: z.ZodBranded<z.ZodString, "CircuitLayoutId">;
14
+ export declare const EventId: z.ZodBranded<z.ZodString, "EventId">;
15
+ export declare const SessionId: z.ZodBranded<z.ZodString, "SessionId">;
16
+ export declare const DriverId: z.ZodBranded<z.ZodString, "DriverId">;
17
+ export declare const EntryId: z.ZodBranded<z.ZodString, "EntryId">;
18
+ export declare const TeamId: z.ZodBranded<z.ZodString, "TeamId">;
19
+ export declare const VehicleId: z.ZodBranded<z.ZodString, "VehicleId">;
20
+ export declare const LapId: z.ZodBranded<z.ZodString, "LapId">;
21
+ export declare const SourceDocumentId: z.ZodBranded<z.ZodString, "SourceDocumentId">;
22
+ export declare const SourcePageId: z.ZodBranded<z.ZodString, "SourcePageId">;
23
+ export declare const NoticeboardSnapshotId: z.ZodBranded<z.ZodString, "NoticeboardSnapshotId">;
24
+ export declare const NoticeboardDocumentId: z.ZodBranded<z.ZodString, "NoticeboardDocumentId">;
25
+ export declare const EventPermitId: z.ZodBranded<z.ZodString, "EventPermitId">;
26
+ export declare const OfficialId: z.ZodBranded<z.ZodString, "OfficialId">;
27
+ export declare const BulletinId: z.ZodBranded<z.ZodString, "BulletinId">;
28
+ export declare const BulletinActionId: z.ZodBranded<z.ZodString, "BulletinActionId">;
29
+ export declare const SessionPublicationId: z.ZodBranded<z.ZodString, "SessionPublicationId">;
30
+ export declare const JudicialDecisionId: z.ZodBranded<z.ZodString, "JudicialDecisionId">;
31
+ export declare const SanctionId: z.ZodBranded<z.ZodString, "SanctionId">;
32
+ export type ChampionshipId = z.infer<typeof ChampionshipId>;
33
+ export type CircuitId = z.infer<typeof CircuitId>;
34
+ export type CircuitLayoutId = z.infer<typeof CircuitLayoutId>;
35
+ export type EventId = z.infer<typeof EventId>;
36
+ export type SessionId = z.infer<typeof SessionId>;
37
+ export type DriverId = z.infer<typeof DriverId>;
38
+ export type EntryId = z.infer<typeof EntryId>;
39
+ export type TeamId = z.infer<typeof TeamId>;
40
+ export type VehicleId = z.infer<typeof VehicleId>;
41
+ export type LapId = z.infer<typeof LapId>;
42
+ export declare const PublicationVersionSchema: z.ZodString;
43
+ export declare const QualityStatusSchema: z.ZodEnum<["unchecked", "verified", "exception", "not_applicable", "provisional"]>;
44
+ export declare const ProvenanceSchema: z.ZodObject<{
45
+ sourcePageId: z.ZodNullable<z.ZodBranded<z.ZodString, "SourcePageId">>;
46
+ sourceDocumentId: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodString, "SourceDocumentId">>>;
47
+ kind: z.ZodOptional<z.ZodEnum<["published", "derived"]>>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ sourcePageId: (string & z.BRAND<"SourcePageId">) | null;
50
+ sourceDocumentId?: (string & z.BRAND<"SourceDocumentId">) | null | undefined;
51
+ kind?: "derived" | "published" | undefined;
52
+ }, {
53
+ sourcePageId: string | null;
54
+ sourceDocumentId?: string | null | undefined;
55
+ kind?: "derived" | "published" | undefined;
56
+ }>;
57
+ export declare const QualitySchema: z.ZodObject<{
58
+ status: z.ZodEnum<["unchecked", "verified", "exception", "not_applicable", "provisional"]>;
59
+ checkedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ pipelineVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ status: "exception" | "not_applicable" | "provisional" | "unchecked" | "verified";
63
+ checkedAt?: string | null | undefined;
64
+ pipelineVersion?: string | null | undefined;
65
+ }, {
66
+ status: "exception" | "not_applicable" | "provisional" | "unchecked" | "verified";
67
+ checkedAt?: string | null | undefined;
68
+ pipelineVersion?: string | null | undefined;
69
+ }>;
70
+ //# sourceMappingURL=primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,EAAE,aAAoB,CAAC;AACpC,eAAO,MAAM,IAAI,aAAoB,CAAC;AACtC,eAAO,MAAM,OAAO,aAA0C,CAAC;AAC/D,eAAO,MAAM,WAAW,aAAwC,CAAC;AACjE,eAAO,MAAM,YAAY,4BAAwB,CAAC;AAClD,eAAO,MAAM,cAAc,4BAAwB,CAAC;AACpD,eAAO,MAAM,YAAY,8CAKV,CAAC;AAEhB,eAAO,MAAM,eAAe,iEAA2D,CAAC;AACxF,eAAO,MAAM,UAAU,0GAAuC,CAAC;AAE/D,eAAO,MAAM,cAAc,6CAA+B,CAAC;AAC3D,eAAO,MAAM,SAAS,wCAA0B,CAAC;AACjD,eAAO,MAAM,eAAe,8CAAgC,CAAC;AAC7D,eAAO,MAAM,OAAO,sCAA0B,CAAC;AAC/C,eAAO,MAAM,SAAS,wCAA4B,CAAC;AACnD,eAAO,MAAM,QAAQ,uCAA2B,CAAC;AACjD,eAAO,MAAM,OAAO,sCAA0B,CAAC;AAC/C,eAAO,MAAM,MAAM,qCAAuB,CAAC;AAC3C,eAAO,MAAM,SAAS,wCAA0B,CAAC;AACjD,eAAO,MAAM,KAAK,oCAAsB,CAAC;AACzC,eAAO,MAAM,gBAAgB,+CAAmC,CAAC;AACjE,eAAO,MAAM,YAAY,2CAA+B,CAAC;AACzD,eAAO,MAAM,qBAAqB,oDAAwC,CAAC;AAC3E,eAAO,MAAM,qBAAqB,oDAAwC,CAAC;AAC3E,eAAO,MAAM,aAAa,4CAAgC,CAAC;AAC3D,eAAO,MAAM,UAAU,yCAA6B,CAAC;AACrD,eAAO,MAAM,UAAU,yCAA6B,CAAC;AACrD,eAAO,MAAM,gBAAgB,+CAAmC,CAAC;AACjE,eAAO,MAAM,oBAAoB,mDAAuC,CAAC;AACzE,eAAO,MAAM,kBAAkB,iDAAqC,CAAC;AACrE,eAAO,MAAM,UAAU,yCAA6B,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,wBAAwB,aAA6B,CAAC;AACnE,eAAO,MAAM,mBAAmB,oFAM9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;EAIxB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export const Id = z.string().min(1);
3
+ export const Uuid = z.string().uuid();
4
+ export const IsoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
5
+ export const IsoDateTime = z.string().datetime({ offset: true });
6
+ export const NullableText = z.string().nullable();
7
+ export const NullableNumber = z.number().nullable();
8
+ export const QueryBoolean = z.preprocess((value) => {
9
+ if (typeof value !== 'string')
10
+ return value;
11
+ if (value === 'true' || value === '1')
12
+ return true;
13
+ if (value === 'false' || value === '0')
14
+ return false;
15
+ return value;
16
+ }, z.boolean());
17
+ export const PublicJsonValue = z.union([z.string(), z.number(), z.boolean(), z.null()]);
18
+ export const PublicJson = z.record(PublicJsonValue).nullable();
19
+ export const ChampionshipId = Id.brand();
20
+ export const CircuitId = Id.brand();
21
+ export const CircuitLayoutId = Id.brand();
22
+ export const EventId = Uuid.brand();
23
+ export const SessionId = Uuid.brand();
24
+ export const DriverId = Uuid.brand();
25
+ export const EntryId = Uuid.brand();
26
+ export const TeamId = Id.brand();
27
+ export const VehicleId = Id.brand();
28
+ export const LapId = Id.brand();
29
+ export const SourceDocumentId = Uuid.brand();
30
+ export const SourcePageId = Uuid.brand();
31
+ export const NoticeboardSnapshotId = Uuid.brand();
32
+ export const NoticeboardDocumentId = Uuid.brand();
33
+ export const EventPermitId = Uuid.brand();
34
+ export const OfficialId = Uuid.brand();
35
+ export const BulletinId = Uuid.brand();
36
+ export const BulletinActionId = Uuid.brand();
37
+ export const SessionPublicationId = Uuid.brand();
38
+ export const JudicialDecisionId = Uuid.brand();
39
+ export const SanctionId = Uuid.brand();
40
+ export const PublicationVersionSchema = z.string().min(1).max(120);
41
+ export const QualityStatusSchema = z.enum([
42
+ 'unchecked',
43
+ 'verified',
44
+ 'exception',
45
+ 'not_applicable',
46
+ 'provisional',
47
+ ]);
48
+ export const ProvenanceSchema = z.object({
49
+ sourcePageId: SourcePageId.nullable(),
50
+ sourceDocumentId: SourceDocumentId.nullable().optional(),
51
+ kind: z.enum(['published', 'derived']).optional(),
52
+ });
53
+ export const QualitySchema = z.object({
54
+ status: QualityStatusSchema,
55
+ checkedAt: IsoDateTime.nullable().optional(),
56
+ pipelineVersion: NullableText.optional(),
57
+ });