@battle-racing/br-common-lib 3.5.0 → 3.8.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.
Files changed (101) hide show
  1. package/REFACTOR_README.md +185 -0
  2. package/br-common-lib.code-workspace +19 -0
  3. package/dist/constants/index.d.ts +2 -0
  4. package/dist/constants/index.js +2 -0
  5. package/dist/constants/payment-provider.d.ts +5 -0
  6. package/dist/constants/payment-provider.js +8 -0
  7. package/dist/constants/payment-status.d.ts +7 -0
  8. package/dist/constants/payment-status.js +10 -0
  9. package/dist/constants/user-role.d.ts +1 -0
  10. package/dist/constants/user-role.js +1 -0
  11. package/dist/schemas/team.schema.d.ts +7 -0
  12. package/dist/schemas/team.schema.js +9 -0
  13. package/dist/types/gameTrack/GameTrackKartConfig.d.ts +9 -0
  14. package/dist/types/gameTrack/index.d.ts +1 -0
  15. package/dist/types/gameTrack/index.js +1 -0
  16. package/dist/types/index.d.ts +3 -0
  17. package/dist/types/index.js +3 -0
  18. package/dist/types/pagination/Pagination.d.ts +3 -0
  19. package/dist/types/pagination/index.d.ts +2 -0
  20. package/dist/types/pagination/index.js +18 -0
  21. package/dist/types/pagination/pagination.schema.d.ts +14 -0
  22. package/dist/types/pagination/pagination.schema.js +16 -0
  23. package/dist/types/racingTeam/RacingTeam.d.ts +6 -0
  24. package/dist/types/racingTeam/RacingTeam.schema.d.ts +44 -0
  25. package/dist/types/racingTeam/RacingTeam.schema.js +27 -0
  26. package/dist/types/racingTeam/RacingTeamMembership.d.ts +6 -0
  27. package/dist/types/racingTeam/RacingTeamMembership.schema.d.ts +31 -0
  28. package/dist/types/racingTeam/RacingTeamMembership.schema.js +27 -0
  29. package/dist/types/racingTeam/index.d.ts +4 -0
  30. package/dist/types/racingTeam/index.js +20 -0
  31. package/dist/types/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +3 -5
  32. package/dist/types/ticketing/GameTicket.d.ts +3 -0
  33. package/dist/types/ticketing/GameTicket.js +2 -0
  34. package/dist/types/ticketing/GameTurn.d.ts +4 -0
  35. package/dist/types/ticketing/GameTurn.js +2 -0
  36. package/dist/types/ticketing/GameTurn.schema.d.ts +92 -0
  37. package/dist/types/ticketing/GameTurn.schema.js +46 -0
  38. package/dist/types/ticketing/GameTurnTask.d.ts +3 -0
  39. package/dist/types/ticketing/GameTurnTask.js +2 -0
  40. package/dist/types/ticketing/GameTurnTask.schema.d.ts +34 -0
  41. package/dist/types/ticketing/GameTurnTask.schema.js +30 -0
  42. package/dist/types/ticketing/PaymentProvider.d.ts +34 -0
  43. package/dist/types/ticketing/PaymentProvider.js +2 -0
  44. package/dist/types/ticketing/PlayerTurn.d.ts +3 -0
  45. package/dist/types/ticketing/PlayerTurn.js +2 -0
  46. package/dist/types/ticketing/Purchase.d.ts +3 -0
  47. package/dist/types/ticketing/Purchase.js +2 -0
  48. package/dist/types/ticketing/index.d.ts +9 -0
  49. package/dist/types/ticketing/index.js +25 -0
  50. package/dist/types/ticketing/ticketing.schemas.d.ts +58 -0
  51. package/dist/types/ticketing/ticketing.schemas.js +41 -0
  52. package/dist/types/user/User.d.ts +4 -9
  53. package/dist/types/user/index.d.ts +3 -1
  54. package/dist/types/user/index.js +5 -1
  55. package/dist/types/user/user-type.schema.d.ts +9 -0
  56. package/dist/types/user/user-type.schema.js +12 -0
  57. package/dist/types/user/user.schema.d.ts +39 -0
  58. package/dist/types/user/user.schema.js +19 -0
  59. package/package.json +6 -2
  60. package/src/constants/index.ts +2 -1
  61. package/src/constants/payment-provider.ts +5 -0
  62. package/src/constants/payment-status.ts +7 -0
  63. package/src/constants/user-role.ts +1 -0
  64. package/src/schemas/team.schema.ts +9 -0
  65. package/src/types/gameTrack/GameTrackKartConfig.ts +10 -0
  66. package/src/types/gameTrack/index.ts +1 -0
  67. package/src/types/index.ts +3 -1
  68. package/src/types/pagination/Pagination.ts +4 -0
  69. package/src/types/pagination/index.ts +2 -0
  70. package/src/types/pagination/pagination.schema.ts +14 -0
  71. package/src/types/racingTeam/RacingTeam.schema.ts +29 -0
  72. package/src/types/racingTeam/RacingTeam.ts +12 -0
  73. package/src/types/racingTeam/RacingTeamMembership.schema.ts +29 -0
  74. package/src/types/racingTeam/RacingTeamMembership.ts +12 -0
  75. package/src/types/racingTeam/index.ts +4 -0
  76. package/src/types/socket/serverToClient/SocketKartServerToClientEventsParams.ts +3 -4
  77. package/src/types/ticketing/GameTicket.ts +4 -0
  78. package/src/types/ticketing/GameTurn.schema.ts +49 -0
  79. package/src/types/ticketing/GameTurn.ts +6 -0
  80. package/src/types/ticketing/GameTurnTask.schema.ts +32 -0
  81. package/src/types/ticketing/GameTurnTask.ts +4 -0
  82. package/src/types/ticketing/PaymentProvider.ts +40 -0
  83. package/src/types/ticketing/Purchase.ts +4 -0
  84. package/src/types/ticketing/index.ts +9 -0
  85. package/src/types/ticketing/ticketing.schemas.ts +43 -0
  86. package/src/types/user/User.ts +4 -9
  87. package/src/types/user/index.ts +4 -1
  88. package/src/types/user/user-type.schema.ts +8 -0
  89. package/src/types/user/user.schema.ts +19 -0
  90. package/README.md +0 -3
  91. package/dist/data/RoleDefinitions.d.ts +0 -2
  92. package/dist/data/RoleDefinitions.js +0 -27
  93. package/dist/types/hardware/screen/ScreenKartPosition.d.ts +0 -4
  94. package/dist/types/hardware/screen/ScreenRaceLaps.d.ts +0 -4
  95. package/dist/types/response/SuccesResponse.d.ts +0 -5
  96. package/dist/types/user/UserOrigin.d.ts +0 -1
  97. package/src/types/user/UserOrigin.ts +0 -1
  98. /package/dist/types/{hardware/screen/ScreenKartPosition.js → gameTrack/GameTrackKartConfig.js} +0 -0
  99. /package/dist/types/{hardware/screen/ScreenRaceLaps.js → pagination/Pagination.js} +0 -0
  100. /package/dist/types/{response/SuccesResponse.js → racingTeam/RacingTeam.js} +0 -0
  101. /package/dist/types/{user/UserOrigin.js → racingTeam/RacingTeamMembership.js} +0 -0
@@ -0,0 +1,185 @@
1
+ # Battle Racing Common Library
2
+
3
+ ## Descripción General
4
+
5
+ Battle Racing Common Library es una librería TypeScript compartida que proporciona tipos, constantes, datos y utilidades comunes para todos los repositorios del ecosistema Battle Racing. Esta librería actúa como el núcleo central de tipos y definiciones que garantizan la consistencia y interoperatividad entre los diferentes componentes del sistema.
6
+
7
+ ## Arquitectura del Sistema Battle Racing
8
+
9
+ El ecosistema Battle Racing está compuesto por **3 proyectos principales** que comparten esta librería común:
10
+
11
+ ### 1. **Web App** (Frontend)
12
+
13
+ - Interfaz de usuario para controladores y espectadores
14
+ - Gestión de juegos, karts y usuarios
15
+ - Comunicación en tiempo real vía WebSockets
16
+
17
+ ### 2. **Backend** (API Server)
18
+
19
+ - Servidor central que maneja la lógica de negocio
20
+ - Gestión de bases de datos y estado de juegos
21
+ - Coordinación entre todos los componentes del sistema
22
+
23
+ ### 3. **Kart Manager** (Software de Kart)
24
+
25
+ - **Software instalado en cada kart** (Raspberry Pi)
26
+ - Gestiona módulos de hardware conectados al kart físico
27
+ - Procesa eventos locales y reporta cambios de estado
28
+ - Se comunica con el backend como representante del kart físico
29
+ - **Actúa como la fuente de verdad del estado del kart**
30
+
31
+ ## Estructura de la Librería
32
+
33
+ ### 📁 `src/types/`
34
+
35
+ Contiene todas las definiciones de tipos TypeScript compartidas:
36
+
37
+ - **`game/`**: Tipos relacionados con juegos (Race, Battle), estados, rankings
38
+ - **`kart/`**: Definiciones de karts, estados de hardware, escudos
39
+ - **`hardware/`**: Módulos de hardware (speed, screen, RGB, flag, sensors, etc.)
40
+ - **`powerUp/`**: Sistema de power-ups y daños
41
+ - **`socket/`**: Eventos y parámetros de comunicación WebSocket
42
+ - **`gameTrack/`**: Configuración de pistas y checkpoints
43
+ - **`user/`**: Usuarios, roles y permisos
44
+ - **`checkpoint/`**: Sistema de checkpoints para carreras
45
+
46
+ ### 📁 `src/constants/`
47
+
48
+ Constantes compartidas del sistema:
49
+
50
+ - Estados de karts y juegos
51
+ - Nombres de módulos de hardware
52
+ - Roles de usuario y permisos
53
+ - Medios y efectos de flags
54
+
55
+ ### 📁 `src/data/`
56
+
57
+ Datos estáticos del juego:
58
+
59
+ - **`all-power-ups.ts`**: Definición completa de todos los power-ups disponibles
60
+ - **`all-damages.ts`**: Efectos de daño y sus impactos
61
+ - **`role-definitions.ts`**: Definiciones de roles y permisos
62
+
63
+ ### 📁 `src/utils/`
64
+
65
+ Utilidades compartidas:
66
+
67
+ - **`roles.utils.ts`**: Funciones helper para gestión de roles
68
+
69
+ ## Sistema de Juegos
70
+
71
+ ### Tipos de Juego
72
+
73
+ - **Race**: Carrera tradicional con checkpoints y vueltas
74
+ - **Battle**: Modo batalla con power-ups y daños
75
+
76
+ ### Power-ups Disponibles
77
+
78
+ La librería incluye un sistema completo de power-ups con diferentes niveles:
79
+
80
+ 1. **Battle Nitro** (Nivel 1): Duplica velocidad temporalmente
81
+ 2. **Battle Trap** (Nivel 2): Lanza trampa que ralentiza oponentes
82
+ 3. **Battle Shot** (Nivel 3): Dispara proyectil a oponente específico
83
+ 4. **Battle Blue Shot** (Nivel 4): Daño al primer lugar
84
+ 5. **Battle Shield** (Nivel 4): Escudo protector contra daños
85
+ 6. **Battle Pulse** (Nivel 5): Ralentiza a todos los oponentes
86
+ 7. **Battle God** (Nivel 5): Poder máximo con velocidad, escudo y ataques
87
+
88
+ ## Sistema de Hardware
89
+
90
+ ### Módulos de Hardware por Kart
91
+
92
+ Cada kart está equipado con múltiples módulos controlados independientemente:
93
+
94
+ - **Speed Module**: Control de velocidad del motor
95
+ - **Screen Module**: Pantalla LCD para información del juego
96
+ - **RGB Module**: Iluminación LED RGB
97
+ - **Flag Module**: Banderas y señales visuales
98
+ - **Sound Module**: Sistema de audio
99
+ - **Ball Sensor/Disk Thrower**: Sistema de lanzamiento de discos
100
+ - **Disk Sensor/Ball Shooter**: Sistema de disparo de bolas
101
+ - **Star Laser**: Láseres frontales y traseros
102
+ - **Steering Wheel**: Volante con LED
103
+ - **Emergency Module**: Sistema de parada de emergencia
104
+
105
+ ### Estados de Hardware
106
+
107
+ Cada módulo tiene estados detallados para monitoreo y control en tiempo real.
108
+
109
+ ## Comunicación WebSocket
110
+
111
+ La librería define eventos WebSocket para comunicación entre componentes:
112
+
113
+ ### Eventos Hardware
114
+
115
+ - Control de módulos individuales
116
+ - Suscripción a datos de hardware
117
+ - Configuración de módulos
118
+
119
+ ### Eventos Power-up
120
+
121
+ - Asignación y activación de power-ups
122
+ - Aplicación de daños
123
+ - Sincronización de estados
124
+
125
+ ### Eventos de Juego
126
+
127
+ - Actualizaciones de estado de juego
128
+ - Rankings y posiciones
129
+ - Eventos de checkpoints
130
+
131
+ ## Sistema de Roles y Permisos
132
+
133
+ Implementa un sistema de control de acceso con roles jerárquicos:
134
+
135
+ - **Super Admin**: Control total del sistema
136
+ - **Admin**: Gestión de juegos y usuarios
137
+ - **Controller**: Control de juegos en ejecución
138
+ - **Viewer**: Solo visualización
139
+
140
+ ## Instalación y Uso
141
+
142
+ ```bash
143
+ npm install @battle-racing/br-common-lib
144
+ ```
145
+
146
+ ### Importación de Tipos
147
+
148
+ ```typescript
149
+ import { Game, Kart, PowerUp, GameTrack, SocketHardwareModulesEventsParams } from '@battle-racing/br-common-lib';
150
+ ```
151
+
152
+ ### Uso de Constantes
153
+
154
+ ```typescript
155
+ import { gameStatus, FLAG_MEDIA_NAME } from '@battle-racing/br-common-lib';
156
+ ```
157
+
158
+ ### Acceso a Datos
159
+
160
+ ```typescript
161
+ import { allPowerUps, allDamages } from '@battle-racing/br-common-lib';
162
+ ```
163
+
164
+ ## Desarrollo y Contribución
165
+
166
+ ### Compilación
167
+
168
+ ```bash
169
+ npm run build
170
+ ```
171
+
172
+ ### Publicación
173
+
174
+ ```bash
175
+ npm run release:patch # Para cambios menores
176
+ npm run release:minor # Para nuevas funcionalidades
177
+ npm run release:major # Para cambios breaking
178
+ ```
179
+
180
+ ### Estructura de Desarrollo
181
+
182
+ - **TypeScript**: Lenguaje principal
183
+ - **ESM**: Módulos ES modernos
184
+ - **Strict typing**: Tipado estricto en toda la librería
185
+ - **Barrel exports**: Re-exports centralizados para fácil importación
@@ -0,0 +1,19 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ },
6
+ {
7
+ "path": "../game-manager-backend"
8
+ },
9
+ {
10
+ "path": "../game-manager-webapp"
11
+ },
12
+ {
13
+ "path": "../game-track-manager"
14
+ },
15
+ {
16
+ "path": "../kart-manager"
17
+ }
18
+ ]
19
+ }
@@ -2,5 +2,7 @@ export * from './checkpoint-type';
2
2
  export * from './hardware';
3
3
  export * from './kart-status';
4
4
  export * from './module-name';
5
+ export * from './payment-provider';
6
+ export * from './payment-status';
5
7
  export * from './permission';
6
8
  export * from './user-role';
@@ -18,5 +18,7 @@ __exportStar(require("./checkpoint-type"), exports);
18
18
  __exportStar(require("./hardware"), exports);
19
19
  __exportStar(require("./kart-status"), exports);
20
20
  __exportStar(require("./module-name"), exports);
21
+ __exportStar(require("./payment-provider"), exports);
22
+ __exportStar(require("./payment-status"), exports);
21
23
  __exportStar(require("./permission"), exports);
22
24
  __exportStar(require("./user-role"), exports);
@@ -0,0 +1,5 @@
1
+ export declare const PAYMENT_PROVIDERS: {
2
+ readonly STRIPE: "stripe";
3
+ readonly PAYPAL: "paypal";
4
+ readonly OTHER: "other";
5
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_PROVIDERS = void 0;
4
+ exports.PAYMENT_PROVIDERS = {
5
+ STRIPE: 'stripe',
6
+ PAYPAL: 'paypal',
7
+ OTHER: 'other',
8
+ };
@@ -0,0 +1,7 @@
1
+ export declare const PAYMENT_STATUSES: {
2
+ readonly PENDING: "pending";
3
+ readonly COMPLETED: "completed";
4
+ readonly FAILED: "failed";
5
+ readonly REFUNDED: "refunded";
6
+ readonly CANCELLED: "cancelled";
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_STATUSES = void 0;
4
+ exports.PAYMENT_STATUSES = {
5
+ PENDING: 'pending',
6
+ COMPLETED: 'completed',
7
+ FAILED: 'failed',
8
+ REFUNDED: 'refunded',
9
+ CANCELLED: 'cancelled',
10
+ };
@@ -1,4 +1,5 @@
1
1
  export declare const USER_ROLE: {
2
2
  readonly SUPER_ADMIN: "SUPER_ADMIN";
3
3
  readonly OPERATOR: "OPERATOR";
4
+ readonly PLAYER: "PLAYER";
4
5
  };
@@ -4,4 +4,5 @@ exports.USER_ROLE = void 0;
4
4
  exports.USER_ROLE = {
5
5
  SUPER_ADMIN: 'SUPER_ADMIN',
6
6
  OPERATOR: 'OPERATOR',
7
+ PLAYER: 'PLAYER',
7
8
  };
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export declare const TeamSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ imageUrl: z.ZodOptional<z.ZodURL>;
5
+ fanatismo: z.ZodOptional<z.ZodNumber>;
6
+ }, z.core.$strip>;
7
+ export type Team = z.infer<typeof TeamSchema>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TeamSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.TeamSchema = zod_1.z.object({
6
+ name: zod_1.z.string().min(3).max(50),
7
+ imageUrl: zod_1.z.url().optional(),
8
+ fanatismo: zod_1.z.number().int().min(0).max(100).optional(),
9
+ });
@@ -0,0 +1,9 @@
1
+ import type { Kart } from '../kart';
2
+ import type { GameTrack } from './GameTrack';
3
+ export interface GameTrackKartConfig {
4
+ gameTrackId: GameTrack['id'];
5
+ kartId: number;
6
+ color: Kart['color'];
7
+ kartNumber: Kart['number'];
8
+ mac: string;
9
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './GameTrack';
2
2
  export * from './GameTrackGameDefaultValues';
3
+ export * from './GameTrackKartConfig';
3
4
  export * from './GameTrackKartsConfig';
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./GameTrack"), exports);
18
18
  __exportStar(require("./GameTrackGameDefaultValues"), exports);
19
+ __exportStar(require("./GameTrackKartConfig"), exports);
19
20
  __exportStar(require("./GameTrackKartsConfig"), exports);
@@ -12,10 +12,13 @@ export * from './gameTrack';
12
12
  export * from './hardware';
13
13
  export * from './kart';
14
14
  export * from './kartTracking';
15
+ export * from './pagination';
15
16
  export * from './powerUp';
17
+ export * from './racingTeam';
16
18
  export * from './response';
17
19
  export * from './role';
18
20
  export * from './socket';
19
21
  export * from './sounds';
22
+ export * from './ticketing';
20
23
  export * from './user';
21
24
  export * from './utils';
@@ -28,10 +28,13 @@ __exportStar(require("./gameTrack"), exports);
28
28
  __exportStar(require("./hardware"), exports);
29
29
  __exportStar(require("./kart"), exports);
30
30
  __exportStar(require("./kartTracking"), exports);
31
+ __exportStar(require("./pagination"), exports);
31
32
  __exportStar(require("./powerUp"), exports);
33
+ __exportStar(require("./racingTeam"), exports);
32
34
  __exportStar(require("./response"), exports);
33
35
  __exportStar(require("./role"), exports);
34
36
  __exportStar(require("./socket"), exports);
35
37
  __exportStar(require("./sounds"), exports);
38
+ __exportStar(require("./ticketing"), exports);
36
39
  __exportStar(require("./user"), exports);
37
40
  __exportStar(require("./utils"), exports);
@@ -0,0 +1,3 @@
1
+ import z from 'zod';
2
+ import { paginationMetadataSchema } from './pagination.schema';
3
+ export type Pagination = z.infer<typeof paginationMetadataSchema>;
@@ -0,0 +1,2 @@
1
+ export * from './Pagination';
2
+ export * from './pagination.schema';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Pagination"), exports);
18
+ __exportStar(require("./pagination.schema"), exports);
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const paginationMetadataSchema: z.ZodObject<{
3
+ nextCursor: z.ZodOptional<z.ZodString>;
4
+ hasMore: z.ZodOptional<z.ZodBoolean>;
5
+ limit: z.ZodNumber;
6
+ }, z.core.$strip>;
7
+ export declare const paginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
8
+ data: z.ZodArray<T>;
9
+ meta: z.ZodObject<{
10
+ nextCursor: z.ZodOptional<z.ZodString>;
11
+ hasMore: z.ZodOptional<z.ZodBoolean>;
12
+ limit: z.ZodNumber;
13
+ }, z.core.$strip>;
14
+ }, z.core.$strip>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paginatedResponseSchema = exports.paginationMetadataSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.paginationMetadataSchema = zod_1.z.object({
6
+ nextCursor: zod_1.z.string().optional(),
7
+ hasMore: zod_1.z.boolean().optional(),
8
+ limit: zod_1.z.number(),
9
+ });
10
+ const paginatedResponseSchema = (itemSchema) => {
11
+ return zod_1.z.object({
12
+ data: zod_1.z.array(itemSchema),
13
+ meta: exports.paginationMetadataSchema,
14
+ });
15
+ };
16
+ exports.paginatedResponseSchema = paginatedResponseSchema;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ import { createRacingTeamSchema, paginatedRacingTeamSchema, racingTeamSchema, updateRacingTeamSchema } from './RacingTeam.schema';
3
+ export type RacingTeam = z.infer<typeof racingTeamSchema>;
4
+ export type CreateRacingTeamDto = z.infer<typeof createRacingTeamSchema>;
5
+ export type UpdateRacingTeamDto = z.infer<typeof updateRacingTeamSchema>;
6
+ export type PaginatedRacingTeam = z.infer<typeof paginatedRacingTeamSchema>;
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ export declare const racingTeamSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ imageUrl: z.ZodOptional<z.ZodString>;
6
+ adminUserId: z.ZodString;
7
+ createdAt: z.ZodDate;
8
+ updatedAt: z.ZodDate;
9
+ }, z.core.$strip>;
10
+ export declare const createRacingTeamSchema: z.ZodObject<{
11
+ name: z.ZodString;
12
+ imageUrl: z.ZodOptional<z.ZodString>;
13
+ adminUserId: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export declare const updateRacingTeamSchema: z.ZodObject<{
16
+ id: z.ZodOptional<z.ZodString>;
17
+ name: z.ZodOptional<z.ZodString>;
18
+ imageUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
19
+ adminUserId: z.ZodOptional<z.ZodString>;
20
+ createdAt: z.ZodOptional<z.ZodDate>;
21
+ updatedAt: z.ZodOptional<z.ZodDate>;
22
+ }, z.core.$strip>;
23
+ export declare const filterRacingTeamSchema: z.ZodObject<{
24
+ name: z.ZodOptional<z.ZodString>;
25
+ adminUserId: z.ZodOptional<z.ZodString>;
26
+ page: z.ZodDefault<z.ZodNumber>;
27
+ limit: z.ZodDefault<z.ZodNumber>;
28
+ cursor: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export declare const paginatedRacingTeamSchema: z.ZodObject<{
31
+ data: z.ZodArray<z.ZodObject<{
32
+ id: z.ZodString;
33
+ name: z.ZodString;
34
+ imageUrl: z.ZodOptional<z.ZodString>;
35
+ adminUserId: z.ZodString;
36
+ createdAt: z.ZodDate;
37
+ updatedAt: z.ZodDate;
38
+ }, z.core.$strip>>;
39
+ meta: z.ZodObject<{
40
+ nextCursor: z.ZodOptional<z.ZodString>;
41
+ hasMore: z.ZodOptional<z.ZodBoolean>;
42
+ limit: z.ZodNumber;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paginatedRacingTeamSchema = exports.filterRacingTeamSchema = exports.updateRacingTeamSchema = exports.createRacingTeamSchema = exports.racingTeamSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const pagination_1 = require("../pagination");
6
+ exports.racingTeamSchema = zod_1.z.object({
7
+ id: zod_1.z.string(),
8
+ name: zod_1.z.string().min(3).max(50),
9
+ imageUrl: zod_1.z.string().url().optional(),
10
+ adminUserId: zod_1.z.string(),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
14
+ exports.createRacingTeamSchema = exports.racingTeamSchema.omit({
15
+ id: true,
16
+ createdAt: true,
17
+ updatedAt: true,
18
+ });
19
+ exports.updateRacingTeamSchema = exports.racingTeamSchema.partial();
20
+ exports.filterRacingTeamSchema = zod_1.z.object({
21
+ name: zod_1.z.string().optional(),
22
+ adminUserId: zod_1.z.string().optional(),
23
+ page: zod_1.z.number().min(1).default(1),
24
+ limit: zod_1.z.number().min(1).max(100).default(10),
25
+ cursor: zod_1.z.string().optional(),
26
+ });
27
+ exports.paginatedRacingTeamSchema = (0, pagination_1.paginatedResponseSchema)(exports.racingTeamSchema);
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ import { joinRequestSchema, teamMemberSchema, createJoinRequestSchema, answerJoinRequestSchema } from './RacingTeamMembership.schema';
3
+ export type JoinRequest = z.infer<typeof joinRequestSchema>;
4
+ export type TeamMember = z.infer<typeof teamMemberSchema>;
5
+ export type CreateJoinRequest = z.infer<typeof createJoinRequestSchema>;
6
+ export type AnswerJoinRequest = z.infer<typeof answerJoinRequestSchema>;
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ export declare const joinRequestSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ racingTeamId: z.ZodString;
5
+ userId: z.ZodString;
6
+ status: z.ZodEnum<{
7
+ PENDING: "PENDING";
8
+ ACCEPTED: "ACCEPTED";
9
+ REJECTED: "REJECTED";
10
+ }>;
11
+ createdAt: z.ZodDate;
12
+ updatedAt: z.ZodDate;
13
+ }, z.core.$strip>;
14
+ export declare const teamMemberSchema: z.ZodObject<{
15
+ racingTeamId: z.ZodString;
16
+ userId: z.ZodString;
17
+ role: z.ZodEnum<{
18
+ PILOT: "PILOT";
19
+ TECHNICIAN: "TECHNICIAN";
20
+ COACH: "COACH";
21
+ }>;
22
+ joinedAt: z.ZodDate;
23
+ }, z.core.$strip>;
24
+ export declare const createJoinRequestSchema: z.ZodObject<{
25
+ racingTeamId: z.ZodString;
26
+ }, z.core.$strip>;
27
+ export declare const answerJoinRequestSchema: z.ZodObject<{
28
+ racingTeamId: z.ZodString;
29
+ targetUserId: z.ZodString;
30
+ accepted: z.ZodBoolean;
31
+ }, z.core.$strip>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // libs/common/src/schemas/racing-team-membership.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.answerJoinRequestSchema = exports.createJoinRequestSchema = exports.teamMemberSchema = exports.joinRequestSchema = void 0;
5
+ const zod_1 = require("zod");
6
+ exports.joinRequestSchema = zod_1.z.object({
7
+ id: zod_1.z.string(),
8
+ racingTeamId: zod_1.z.string(),
9
+ userId: zod_1.z.string(),
10
+ status: zod_1.z.enum(['PENDING', 'ACCEPTED', 'REJECTED']),
11
+ createdAt: zod_1.z.date(),
12
+ updatedAt: zod_1.z.date(),
13
+ });
14
+ exports.teamMemberSchema = zod_1.z.object({
15
+ racingTeamId: zod_1.z.string(),
16
+ userId: zod_1.z.string(),
17
+ role: zod_1.z.enum(['PILOT', 'TECHNICIAN', 'COACH']),
18
+ joinedAt: zod_1.z.date(),
19
+ });
20
+ exports.createJoinRequestSchema = zod_1.z.object({
21
+ racingTeamId: zod_1.z.string(),
22
+ });
23
+ exports.answerJoinRequestSchema = zod_1.z.object({
24
+ racingTeamId: zod_1.z.string(),
25
+ targetUserId: zod_1.z.string(),
26
+ accepted: zod_1.z.boolean(),
27
+ });
@@ -0,0 +1,4 @@
1
+ export * from './RacingTeam';
2
+ export * from './RacingTeam.schema';
3
+ export * from './RacingTeamMembership';
4
+ export * from './RacingTeamMembership.schema';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./RacingTeam"), exports);
18
+ __exportStar(require("./RacingTeam.schema"), exports);
19
+ __exportStar(require("./RacingTeamMembership"), exports);
20
+ __exportStar(require("./RacingTeamMembership.schema"), exports);
@@ -1,5 +1,5 @@
1
1
  import type { Game, GameType } from '../../game';
2
- import type { GameTrack } from '../../gameTrack';
2
+ import type { GameTrack, GameTrackKartConfig } from '../../gameTrack';
3
3
  import type { Kart, KartStatus } from '../../kart';
4
4
  import type { Response } from '../../response';
5
5
  import type { SocketPowerUpEventsParams } from '../SocketPowerUpEventsParams';
@@ -11,16 +11,14 @@ export type SocketKartPowerUpEventsParams = {
11
11
  [Key in keyof SocketPowerUpEventsParams as `kart:${Key}`]: SocketPowerUpEventsParams[Key];
12
12
  };
13
13
  export interface SocketKartEventsParams {
14
- 'kart:updated': {
15
- kart: Kart;
16
- };
17
14
  'kart:init:response': Response<{
18
15
  kart: Kart;
19
16
  gameTrack: GameTrack;
20
17
  }>;
21
- /** Whenever the Game Track config changed */
18
+ /** Whenever the Game Track config changed, the config might change as well*/
22
19
  'kart:gameTrack:updated': {
23
20
  gameTrack: GameTrack;
21
+ config: GameTrackKartConfig;
24
22
  };
25
23
  /** When the physical button of the game track is pressed */
26
24
  'kart:gameTrack:emergency:started': undefined;
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import { GameTicketSchema } from './ticketing.schemas';
3
+ export type GameTicket = z.infer<typeof GameTicketSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ import { GameTurnQueueItemSchema, GameTurnSchema } from './GameTurn.schema';
3
+ export type GameTurn = z.infer<typeof GameTurnSchema>;
4
+ export type GameTurnQueueItem = z.infer<typeof GameTurnQueueItemSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });