@koloseum/types 0.1.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.
@@ -0,0 +1,314 @@
1
+ import type { Database as DatabaseGenerated } from "./database-generated";
2
+ import type {
3
+ AccountType,
4
+ AppRole,
5
+ BranchAddressObject,
6
+ BranchAmenitiesObject,
7
+ CompanyInformationUpdateJson,
8
+ CompanyVerificationDataObject,
9
+ GamingSocialsDataObject,
10
+ GenderIdentity,
11
+ Institution,
12
+ InstitutionNameIssue,
13
+ MinorRelation,
14
+ PersonVerificationLogDataObject,
15
+ PersonalDataUpdateRequestJson,
16
+ PhoneOTPRequestStatus,
17
+ PhoneOTPSendCodeAttempt,
18
+ PronounsItem,
19
+ RegistrationCheckObject,
20
+ RegistrationStep,
21
+ Sex,
22
+ SocialMediaPlatform,
23
+ } from "./public/auth";
24
+
25
+ import { MergeDeep } from "type-fest";
26
+
27
+ export type Database = MergeDeep<
28
+ DatabaseGenerated,
29
+ {
30
+ compliance: {
31
+ Tables: {
32
+ active_registrations: {
33
+ Row: {
34
+ current_step: RegistrationStep<AccountType>;
35
+ type: AccountType;
36
+ };
37
+ Insert: {
38
+ current_step: RegistrationStep<AccountType>;
39
+ type: AccountType;
40
+ };
41
+ Update: {
42
+ current_step?: RegistrationStep<AccountType>;
43
+ type?: AccountType;
44
+ };
45
+ };
46
+ data_update_requests: {
47
+ Row: {
48
+ account_type: AccountType;
49
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
50
+ };
51
+ Insert: {
52
+ account_type: AccountType;
53
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
54
+ };
55
+ Update: {
56
+ account_type: AccountType;
57
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
58
+ };
59
+ };
60
+ data_updates: {
61
+ Row: {
62
+ account_type: AccountType;
63
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
64
+ };
65
+ Insert: {
66
+ account_type: AccountType;
67
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
68
+ };
69
+ Update: {
70
+ account_type: AccountType;
71
+ updates: PersonalDataUpdateRequestJson | CompanyInformationUpdateJson;
72
+ };
73
+ };
74
+ lounge_branches: {
75
+ Row: {
76
+ address: BranchAddressObject;
77
+ amenities: BranchAmenitiesObject | null;
78
+ };
79
+ Insert: {
80
+ address: BranchAddressObject;
81
+ amenities?: BranchAmenitiesObject | null;
82
+ };
83
+ Update: {
84
+ address?: BranchAddressObject;
85
+ amenities?: BranchAmenitiesObject | null;
86
+ };
87
+ };
88
+ lounge_company_verification_attempts: {
89
+ Row: {
90
+ company_data: Omit<CompanyVerificationDataObject, "companyNumber" | "dateOfDissolution" | "countryCode">;
91
+ };
92
+ Insert: {
93
+ company_data: Omit<CompanyVerificationDataObject, "companyNumber" | "dateOfDissolution" | "countryCode">;
94
+ };
95
+ Update: {
96
+ company_data?: Omit<CompanyVerificationDataObject, "companyNumber" | "dateOfDissolution" | "countryCode">;
97
+ };
98
+ };
99
+ lounge_staff: {
100
+ Row: {
101
+ gender_identity: GenderIdentity | null;
102
+ pronouns: PronounsItem[] | null;
103
+ role: AppRole;
104
+ sex: Sex;
105
+ };
106
+ Insert: {
107
+ gender_identity?: GenderIdentity | null;
108
+ pronouns?: PronounsItem[] | null;
109
+ role: AppRole;
110
+ sex?: Sex;
111
+ };
112
+ Update: {
113
+ gender_identity?: GenderIdentity | null;
114
+ pronouns?: PronounsItem[] | null;
115
+ role?: AppRole;
116
+ sex?: Sex;
117
+ };
118
+ };
119
+ lounge_staff_verification_attempts: {
120
+ Row: {
121
+ person_data: PersonVerificationLogDataObject | null;
122
+ };
123
+ Insert: {
124
+ person_data: PersonVerificationLogDataObject | null;
125
+ };
126
+ Update: {
127
+ person_data: PersonVerificationLogDataObject | null;
128
+ };
129
+ };
130
+ player_id_verification_attempts: {
131
+ Row: {
132
+ person_data: PersonVerificationLogDataObject | null;
133
+ };
134
+ Insert: {
135
+ person_data: PersonVerificationLogDataObject | null;
136
+ };
137
+ Update: {
138
+ person_data: PersonVerificationLogDataObject | null;
139
+ };
140
+ };
141
+ player_minor_rep_personal_details: {
142
+ Row: {
143
+ gender_identity: GenderIdentity | null;
144
+ pronouns: PronounsItem[] | null;
145
+ sex: Sex;
146
+ };
147
+ Insert: {
148
+ gender_identity?: GenderIdentity | null;
149
+ pronouns?: PronounsItem[] | null;
150
+ sex?: Sex;
151
+ };
152
+ Update: {
153
+ gender_identity?: GenderIdentity | null;
154
+ pronouns?: PronounsItem[] | null;
155
+ sex?: Sex;
156
+ };
157
+ };
158
+ player_minor_rep_id_verification_attempts: {
159
+ Row: {
160
+ person_data: PersonVerificationLogDataObject | null;
161
+ };
162
+ Insert: {
163
+ person_data: PersonVerificationLogDataObject | null;
164
+ };
165
+ Update: {
166
+ person_data: PersonVerificationLogDataObject | null;
167
+ };
168
+ };
169
+ player_minor_rep_phone_verification_attempts: {
170
+ Row: {
171
+ send_code_attempts: PhoneOTPSendCodeAttempt[];
172
+ };
173
+ Insert: {
174
+ send_code_attempts: PhoneOTPSendCodeAttempt[];
175
+ created_at: Date;
176
+ updated_at: Date;
177
+ };
178
+ Update: {
179
+ updated_at: Date;
180
+ };
181
+ };
182
+ player_minor_reps: {
183
+ Insert: {
184
+ relation?: MinorRelation;
185
+ };
186
+ Update: {
187
+ relation?: MinorRelation;
188
+ };
189
+ };
190
+ player_socials: {
191
+ Row: {
192
+ platform: SocialMediaPlatform;
193
+ };
194
+ Insert: {
195
+ platform: SocialMediaPlatform;
196
+ };
197
+ Update: {
198
+ platform?: SocialMediaPlatform;
199
+ };
200
+ };
201
+ players: {
202
+ Row: {
203
+ gender_identity: GenderIdentity | null;
204
+ pronouns: PronounsItem[] | null;
205
+ sex: Sex;
206
+ };
207
+ Insert: {
208
+ gender_identity?: GenderIdentity | null;
209
+ pronouns?: PronounsItem[] | null;
210
+ sex?: Sex;
211
+ };
212
+ Update: {
213
+ gender_identity?: GenderIdentity | null;
214
+ pronouns?: PronounsItem[] | null;
215
+ sex?: Sex;
216
+ };
217
+ };
218
+ };
219
+ Functions: {
220
+ create_lounge_staff: {
221
+ Args: {
222
+ p_sex: Sex;
223
+ p_role?: AppRole;
224
+ p_gender_identity?: GenderIdentity;
225
+ p_pronouns?: PronounsItem[];
226
+ };
227
+ };
228
+ create_player: {
229
+ Args: {
230
+ p_sex: Sex;
231
+ p_gender_identity?: GenderIdentity;
232
+ p_pronouns?: PronounsItem[];
233
+ };
234
+ };
235
+ create_player_minor_rep: {
236
+ Args: {
237
+ p_sex: Sex;
238
+ p_relation: MinorRelation;
239
+ p_gender_identity?: GenderIdentity;
240
+ p_pronouns?: PronounsItem[];
241
+ };
242
+ };
243
+ create_varsity_stint: {
244
+ Args: {
245
+ p_institution_code: string | null;
246
+ p_institution_name_issue?: InstitutionNameIssue;
247
+ };
248
+ };
249
+ extract_names: {
250
+ Returns: {
251
+ first_name: string;
252
+ middle_names: string | null;
253
+ last_name: string;
254
+ }[];
255
+ };
256
+ gen_platform_id: {
257
+ Args: {
258
+ account_type: AccountType;
259
+ };
260
+ };
261
+ get_active_registration: {
262
+ Returns: Omit<RegistrationCheckObject<"player">, "error"> | Omit<RegistrationCheckObject<"lounge">, "error">;
263
+ };
264
+ get_player_ids: {
265
+ Returns: {
266
+ r_user_id: string | null;
267
+ r_player_id: string;
268
+ }[];
269
+ };
270
+ link_existing_minor_rep: {
271
+ Args: {
272
+ p_minor_relation: MinorRelation;
273
+ p_other_relation: string | null;
274
+ };
275
+ };
276
+ log_minor_rep_phone_verification: {
277
+ Args: {
278
+ p_status: PhoneOTPRequestStatus;
279
+ p_updated_at: Date;
280
+ p_send_code_attempts?: PhoneOTPSendCodeAttempt[];
281
+ p_created_at?: Date;
282
+ };
283
+ };
284
+ minor_rep_phone: {
285
+ Returns: string | null;
286
+ };
287
+ submit_gaming_and_socials_data: {
288
+ Args: {
289
+ p_primary_platform: GamingSocialsDataObject["primaryPlatform"];
290
+ p_consoles: GamingSocialsDataObject["consoles"] | null;
291
+ p_socials: GamingSocialsDataObject["socials"] | null;
292
+ };
293
+ };
294
+ validate_pronouns: {
295
+ Args: {
296
+ pronouns: PronounsItem[];
297
+ };
298
+ };
299
+ };
300
+ Enums: {
301
+ registration_step: 1 | 2 | 3 | 4 | 0;
302
+ };
303
+ };
304
+ public: {
305
+ Tables: {
306
+ varsity_institutions: {
307
+ Row: Institution;
308
+ Insert: Institution;
309
+ Update: Institution;
310
+ };
311
+ };
312
+ };
313
+ }
314
+ >;
@@ -0,0 +1,371 @@
1
+ import type { User } from "@supabase/supabase-js";
2
+ import type { Database } from "../database";
3
+
4
+ /* GENERAL */
5
+ export type AccountType = "player" | "lounge";
6
+
7
+ export type AppRole = Database["compliance"]["Enums"]["app_role"] | null;
8
+
9
+ export interface AuthenticationJWT {
10
+ aud: string;
11
+ exp: number;
12
+ iat: number;
13
+ sub: string;
14
+ email: string;
15
+ phone: string;
16
+ app_metadata: {
17
+ provider: string;
18
+ providers: string[];
19
+ role: AppRole;
20
+ };
21
+ user_metadata: {
22
+ email_verified: boolean;
23
+ phone_verified: boolean;
24
+ sub: string;
25
+ };
26
+ role: string;
27
+ aal: string;
28
+ amr: [{ method: string; timestamp: number }];
29
+ session_id: string;
30
+ is_anonymous: boolean;
31
+ }
32
+
33
+ export type AuthenticationType = "login" | "register" | "otp";
34
+
35
+ export interface CustomError {
36
+ code: number;
37
+ message: string;
38
+ }
39
+
40
+ export interface IGDBPlatformsResponse {
41
+ id: number;
42
+ abbreviation: string;
43
+ category: number;
44
+ generation: number;
45
+ name: string;
46
+ platform_family: number;
47
+ }
48
+
49
+ export type UserWithRole = User & { app_metadata: { role: AppRole } };
50
+
51
+ /* REGISTRATION */
52
+ export type PlayerRegistrationStep = Database["compliance"]["Enums"]["registration_step"];
53
+
54
+ export type LoungeRegistrationStep = Exclude<Database["compliance"]["Enums"]["registration_step"], 4>;
55
+
56
+ export type RegistrationStep<AccountType> = AccountType extends "player" ? PlayerRegistrationStep : LoungeRegistrationStep;
57
+
58
+ export interface RegistrationCheckObject<AccountType> {
59
+ type?: AccountType;
60
+ currentStep?: RegistrationStep<AccountType>;
61
+ verifiedData?: AccountType extends "player" ? PersonVerificationDataObject : CompanyVerificationDataObject;
62
+ superuserData?: AccountType extends "player" ? undefined : PlayerInformationObject;
63
+ completed?: boolean;
64
+ error?: CustomError;
65
+ }
66
+
67
+ export interface RegistrationStepObject<AccountType> {
68
+ number: RegistrationStep<AccountType>;
69
+ label: string;
70
+ title: string;
71
+ caption: string;
72
+ }
73
+
74
+ /* PLAYER */
75
+ // OTP verification
76
+ export interface PhoneOTPData {
77
+ awaitingOTP: boolean;
78
+ dateUpdated?: Date;
79
+ phoneToVerify?: string;
80
+ existingMinorRepData?: ExistingMinorRepDataObject;
81
+ verifiedPhone?: string;
82
+ }
83
+
84
+ export interface OTPInputProperties {
85
+ name: string;
86
+ type: string;
87
+ label: string;
88
+ placeholder: string;
89
+ autocomplete: string;
90
+ buttonLabel: string;
91
+ }
92
+
93
+ export type PhoneOTPRequestStatus = Database["compliance"]["Enums"]["twilio_verification_status"];
94
+
95
+ export interface PhoneOTPSendCodeAttempt {
96
+ attempt_sid: string;
97
+ channel: string;
98
+ time: string;
99
+ }
100
+
101
+ // ID verification
102
+ export interface IdentityCountry {
103
+ name: string;
104
+ code: string;
105
+ }
106
+
107
+ export interface IdentityTitleData {
108
+ currentStep: PlayerRegistrationStep;
109
+ title: string;
110
+ caption: string;
111
+ }
112
+
113
+ export type IdentityType = Database["compliance"]["Enums"]["id_type"];
114
+
115
+ export interface IdentityTypeObject {
116
+ type: IdentityType;
117
+ label: string;
118
+ }
119
+
120
+ export interface IdentityDataObject {
121
+ country: string;
122
+ type: IdentityType;
123
+ number: string;
124
+ isForMinorRep: boolean;
125
+ }
126
+
127
+ export type IdentityVerificationRequestObject = Omit<IdentityDataObject, "isForMinorRep">;
128
+
129
+ export interface RawPersonVerificationDataObject {
130
+ firstName: string;
131
+ middleNames: string;
132
+ lastName: string;
133
+ dateOfBirth: string;
134
+ dateOfIssue: string;
135
+ dateOfExpiry?: string;
136
+ phone?: string;
137
+ minorRepPhone?: string;
138
+ identityType: IdentityType;
139
+ identityCountry: string;
140
+ }
141
+
142
+ export type PersonVerificationLogDataObject = Omit<RawPersonVerificationDataObject, "phone" | "minorRepPhone" | "identityType" | "identityCountry">;
143
+
144
+ export type PersonVerificationDataObject = Omit<RawPersonVerificationDataObject, "dateOfIssue" | "dateOfExpiry">;
145
+
146
+ export type PersonInformationObject = Omit<PersonVerificationDataObject, "phone" | "minorRepPhone">;
147
+
148
+ export type PlayerInformationObject = Omit<PersonInformationObject, "dateOfIssue" | "dateOfExpiry">;
149
+
150
+ export interface ExistingMinorRepDataObject {
151
+ userId: string;
152
+ playerId?: string;
153
+ relation: MinorRelation;
154
+ otherRelation?: string;
155
+ }
156
+
157
+ // Personal information
158
+ export type GenderIdentity = Database["compliance"]["Enums"]["gender_identity"];
159
+
160
+ export interface GenderIdentityObject {
161
+ name: GenderIdentity;
162
+ info: string;
163
+ }
164
+
165
+ export type MinorRelation = Database["compliance"]["Enums"]["minor_relation"];
166
+
167
+ export type PronounsCheckboxes = {
168
+ [key in PronounsType]?: HTMLInputElement;
169
+ };
170
+
171
+ export type PronounsItem = Database["compliance"]["Enums"]["pronouns"];
172
+
173
+ export interface PronounsObject {
174
+ type: PronounsType;
175
+ value: PronounsItem;
176
+ }
177
+
178
+ export type PronounsType = "male" | "female" | "neutral" | "none";
179
+
180
+ export type Sex = Database["compliance"]["Enums"]["sex"] | null;
181
+
182
+ export interface SexObject {
183
+ value: Sex;
184
+ label: string;
185
+ }
186
+
187
+ // Varsity
188
+ export interface Institution {
189
+ code: string;
190
+ name: string;
191
+ }
192
+
193
+ export type InstitutionNameIssue = Database["compliance"]["Enums"]["institution_name_issue"];
194
+
195
+ // Validation
196
+ export interface PersonalDataFormattingObject {
197
+ formattedFirstName?: string;
198
+ formattedMiddleNames?: string;
199
+ formattedLastName?: string;
200
+ formattedBirthDate?: string;
201
+ scannedIdCopy?: File;
202
+ }
203
+
204
+ export interface PersonalDataObject {
205
+ firstName: string;
206
+ middleNames?: string;
207
+ lastName: string;
208
+ pseudonym?: string;
209
+ dateOfBirth: string;
210
+ showDateOfBirth: boolean;
211
+ nationality: string;
212
+ sex: Sex;
213
+ genderIdentity?: GenderIdentity;
214
+ pronouns?: PronounsItem[];
215
+ showPronouns?: boolean;
216
+ relation?: MinorRelation;
217
+ otherRelation?: string;
218
+ }
219
+
220
+ export interface PersonalDataUpdateRequestJson {
221
+ firstName?: { old: string; new: string };
222
+ middleNames?: { old: string | null; new: string | null };
223
+ lastName?: { old: string; new: string };
224
+ dateOfBirth?: { old: string; new: string };
225
+ }
226
+
227
+ export interface VarsityDataObject {
228
+ institutionCode?: string;
229
+ institutionNameIssue?: InstitutionNameIssue;
230
+ formattedInstitutionName?: string;
231
+ enrollmentYear?: number;
232
+ graduationYear?: number;
233
+ }
234
+
235
+ // Gaming and socials
236
+ export interface GameConsole {
237
+ id: string;
238
+ name: string;
239
+ quantity?: number;
240
+ platformShorthand: string;
241
+ }
242
+
243
+ export interface GamePlatform {
244
+ name: string;
245
+ shorthand: string;
246
+ onlineName: string | null;
247
+ }
248
+
249
+ export type SocialMediaPlatform = Database["public"]["Enums"]["social_media_platform"];
250
+
251
+ export interface SocialMediaPlatformObject {
252
+ value: SocialMediaPlatform;
253
+ linkPrefix: string;
254
+ }
255
+
256
+ export interface PlayerSocialsObject {
257
+ platform: SocialMediaPlatformObject;
258
+ handle: string;
259
+ }
260
+
261
+ export interface GamingSocialsDataObject {
262
+ primaryPlatform: {
263
+ platformShorthand: string;
264
+ username: string | null;
265
+ };
266
+ consoles?: {
267
+ consoleId: string;
268
+ quantity: number;
269
+ isPrimary: boolean;
270
+ }[];
271
+ socials?: {
272
+ platform: SocialMediaPlatform;
273
+ handle: string;
274
+ }[];
275
+ }
276
+
277
+ /* LOUNGE */
278
+ // Company registration //
279
+ export interface CompanyDataObject {
280
+ companyNumber: string;
281
+ countryCode: string;
282
+ }
283
+
284
+ export interface CompanyPerson {
285
+ firstName: string;
286
+ middleNames?: string;
287
+ lastName: string;
288
+ number: string;
289
+ }
290
+
291
+ export interface CompanyVerificationDataObject {
292
+ companyName: string;
293
+ companyNumber: string;
294
+ companyType: string;
295
+ dateOfRegistration: string;
296
+ dateOfDissolution?: string;
297
+ countryCode: string;
298
+ persons: CompanyPerson[];
299
+ }
300
+
301
+ export interface CompanyInformationObject {
302
+ companyName: string;
303
+ dateOfRegistration: string;
304
+ tradeName?: string;
305
+ website?: string;
306
+ }
307
+
308
+ export interface CompanyInformationFormattingObject {
309
+ formattedCompanyName?: string;
310
+ formattedRegistrationDate?: string;
311
+ registrationCertificateCopy?: File;
312
+ }
313
+
314
+ export interface CompanyInformationUpdateJson {
315
+ companyName?: { old: string; new: string };
316
+ dateOfRegistration?: { old: string; new: string };
317
+ tradeName?: { old: string | null; new: string | null };
318
+ }
319
+
320
+ // Superuser registration
321
+ export type SuperuserIdentityDataObject = Omit<IdentityDataObject, "isForMinorRep">;
322
+
323
+ export type SuperuserPersonalDataObject = Omit<PersonalDataObject, "showDateOfBirth" | "relation" | "otherRelation">;
324
+
325
+ // Branch information
326
+ export interface County {
327
+ name: string;
328
+ code: number;
329
+ subCounties: string[];
330
+ }
331
+
332
+ export type LuggageDepositType = Database["compliance"]["Enums"]["luggage_deposit_type"];
333
+
334
+ export interface LuggageDepositObject {
335
+ type: LuggageDepositType;
336
+ slots: number;
337
+ }
338
+
339
+ export interface FibreInternetObject {
340
+ provider: string;
341
+ speed: number;
342
+ }
343
+
344
+ export interface BranchAddressObject {
345
+ buildingName: string;
346
+ unitNumber?: string;
347
+ streetName: string;
348
+ boxNumber?: string;
349
+ postalCode?: string;
350
+ town: string;
351
+ subCounty: string;
352
+ county: string;
353
+ }
354
+
355
+ export interface BranchAmenitiesObject {
356
+ washrooms?: string;
357
+ luggageDeposit?: LuggageDepositObject;
358
+ internet?: FibreInternetObject;
359
+ cctvCameras?: number;
360
+ fireExits?: number;
361
+ parking?: string;
362
+ eatery?: boolean;
363
+ }
364
+
365
+ export interface BranchInformationObject {
366
+ name: string;
367
+ address: BranchAddressObject;
368
+ amenities: BranchAmenitiesObject | null;
369
+ phone: string;
370
+ email?: string;
371
+ }