@battle-racing/br-common-lib 4.5.0 → 4.6.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 (86) hide show
  1. package/dist/domains/command/Command.schema.d.ts +76 -10
  2. package/dist/domains/command/Command.schema.js +17 -3
  3. package/dist/domains/command/Command.types.d.ts +3 -1
  4. package/dist/domains/damage/Damage.schema.d.ts +2 -2
  5. package/dist/domains/flow/Flow.schema.d.ts +39 -6
  6. package/dist/domains/hardware/KartHardwareState.schema.js +8 -8
  7. package/dist/domains/hardware/KartHardwareState.types.d.ts +3 -0
  8. package/dist/domains/hardware/KartHardwareState.types.js +2 -0
  9. package/dist/domains/hardware/ModuleStatus.schema.d.ts +28 -0
  10. package/dist/domains/hardware/ModuleStatus.schema.js +4 -0
  11. package/dist/domains/hardware/ballSensor/BallSensor.const.d.ts +5 -0
  12. package/dist/domains/hardware/ballSensor/BallSensor.const.js +6 -1
  13. package/dist/domains/hardware/ballSensor/BallSensor.schema.d.ts +5 -0
  14. package/dist/domains/hardware/ballSensor/BallSensor.schema.js +2 -1
  15. package/dist/domains/hardware/ballSensor/BallSensor.types.d.ts +2 -1
  16. package/dist/domains/hardware/flag/Flag.const.d.ts +7 -0
  17. package/dist/domains/hardware/flag/Flag.const.js +8 -1
  18. package/dist/domains/hardware/flag/Flag.schema.d.ts +11 -4
  19. package/dist/domains/hardware/flag/Flag.schema.js +5 -2
  20. package/dist/domains/hardware/flag/Flag.types.d.ts +2 -1
  21. package/dist/domains/hardware/index.d.ts +1 -0
  22. package/dist/domains/hardware/index.js +2 -1
  23. package/dist/domains/hardware/lights/Lights.const.d.ts +4 -0
  24. package/dist/domains/hardware/lights/Lights.const.js +5 -1
  25. package/dist/domains/hardware/lights/Lights.schema.d.ts +16 -0
  26. package/dist/domains/hardware/lights/Lights.schema.js +5 -1
  27. package/dist/domains/hardware/lights/Lights.types.d.ts +3 -1
  28. package/dist/domains/hardware/rgb/RGB.const.d.ts +4 -0
  29. package/dist/domains/hardware/rgb/RGB.const.js +5 -1
  30. package/dist/domains/hardware/rgb/RGB.schema.d.ts +4 -0
  31. package/dist/domains/hardware/rgb/RGB.schema.js +2 -1
  32. package/dist/domains/hardware/rgb/RGB.types.d.ts +2 -1
  33. package/dist/domains/hardware/sound/Sound.const.d.ts +3 -0
  34. package/dist/domains/hardware/sound/Sound.const.js +4 -1
  35. package/dist/domains/hardware/sound/Sound.schema.d.ts +3 -0
  36. package/dist/domains/hardware/sound/Sound.schema.js +2 -1
  37. package/dist/domains/hardware/sound/Sound.types.d.ts +2 -1
  38. package/dist/domains/hardware/steering-wheel/SteeringWheel.const.d.ts +4 -0
  39. package/dist/domains/hardware/steering-wheel/SteeringWheel.const.js +7 -0
  40. package/dist/domains/hardware/steering-wheel/SteeringWheel.schema.d.ts +4 -0
  41. package/dist/domains/hardware/steering-wheel/SteeringWheel.schema.js +3 -1
  42. package/dist/domains/hardware/steering-wheel/SteeringWheel.types.d.ts +2 -1
  43. package/dist/domains/powerUp/PowerUp.schema.d.ts +117 -18
  44. package/dist/domains/session/Session.schema.d.ts +2 -0
  45. package/dist/domains/socket/index.d.ts +1 -0
  46. package/dist/domains/socket/index.js +1 -0
  47. package/dist/domains/socket/screen/SocketScreenServerToClientEventsParams.d.ts +14 -0
  48. package/dist/domains/socket/screen/SocketScreenServerToClientEventsParams.js +2 -0
  49. package/dist/domains/socket/screen/index.d.ts +1 -0
  50. package/dist/domains/socket/screen/index.js +17 -0
  51. package/dist/domains/ticketing/Ticketing.schema.d.ts +4 -0
  52. package/dist/domains/ticketing/Ticketing.schema.js +2 -0
  53. package/dist/domains/user/User.schema.d.ts +24 -9
  54. package/dist/domains/user/User.schema.js +15 -3
  55. package/dist/domains/user/User.types.d.ts +2 -1
  56. package/package.json +1 -1
  57. package/src/domains/command/Command.schema.ts +30 -12
  58. package/src/domains/command/Command.types.ts +4 -0
  59. package/src/domains/hardware/KartHardwareState.schema.ts +4 -4
  60. package/src/domains/hardware/KartHardwareState.types.ts +4 -0
  61. package/src/domains/hardware/ModuleStatus.schema.ts +4 -0
  62. package/src/domains/hardware/ballSensor/BallSensor.const.ts +6 -0
  63. package/src/domains/hardware/ballSensor/BallSensor.schema.ts +3 -1
  64. package/src/domains/hardware/ballSensor/BallSensor.types.ts +2 -0
  65. package/src/domains/hardware/flag/Flag.const.ts +8 -0
  66. package/src/domains/hardware/flag/Flag.schema.ts +6 -2
  67. package/src/domains/hardware/flag/Flag.types.ts +2 -0
  68. package/src/domains/hardware/index.ts +2 -1
  69. package/src/domains/hardware/lights/Lights.const.ts +5 -0
  70. package/src/domains/hardware/lights/Lights.schema.ts +7 -1
  71. package/src/domains/hardware/lights/Lights.types.ts +9 -1
  72. package/src/domains/hardware/rgb/RGB.const.ts +5 -0
  73. package/src/domains/hardware/rgb/RGB.schema.ts +3 -1
  74. package/src/domains/hardware/rgb/RGB.types.ts +2 -0
  75. package/src/domains/hardware/sound/Sound.const.ts +4 -0
  76. package/src/domains/hardware/sound/Sound.schema.ts +3 -1
  77. package/src/domains/hardware/sound/Sound.types.ts +3 -1
  78. package/src/domains/hardware/steering-wheel/SteeringWheel.const.ts +4 -0
  79. package/src/domains/hardware/steering-wheel/SteeringWheel.schema.ts +3 -0
  80. package/src/domains/hardware/steering-wheel/SteeringWheel.types.ts +3 -1
  81. package/src/domains/socket/index.ts +1 -0
  82. package/src/domains/socket/screen/SocketScreenServerToClientEventsParams.ts +19 -0
  83. package/src/domains/socket/screen/index.ts +1 -0
  84. package/src/domains/ticketing/Ticketing.schema.ts +2 -0
  85. package/src/domains/user/User.schema.ts +15 -2
  86. package/src/domains/user/User.types.ts +7 -5
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
- import { userSchema, userTypeSchema, userWithPasswordSchema, userInitialRegistrationSchema, userVerifySchema, userCompleteProfileSchema, userLoginInputSchema, authUserSchema } from './User.schema';
2
+ import { authUserSchema, initialUserSchema, userCompleteProfileSchema, userInitialRegistrationSchema, userLoginInputSchema, userSchema, userTypeSchema, userVerifySchema, userWithPasswordSchema } from './User.schema';
3
3
  export type UserType = z.infer<typeof userTypeSchema>;
4
4
  export type User = z.infer<typeof userSchema>;
5
5
  export type UserWithPassword = z.infer<typeof userWithPasswordSchema>;
6
6
  export type AuthUser = z.infer<typeof authUserSchema>;
7
+ export type InitialUser = z.infer<typeof initialUserSchema>;
7
8
  export type UserInitialRegistration = z.infer<typeof userInitialRegistrationSchema>;
8
9
  export type UserVerify = z.infer<typeof userVerifySchema>;
9
10
  export type UserCompleteProfile = z.infer<typeof userCompleteProfileSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "4.5.0",
3
+ "version": "4.6.1",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -10,6 +10,8 @@ import {
10
10
  screenCountdownParamsSchema,
11
11
  screenFinishViewInputSchema,
12
12
  screenUpdateGameViewInputSchema,
13
+ showLightsColorParamsSchema,
14
+ showLightsEffectParamsSchema,
13
15
  speedChangeOptionsSchema,
14
16
  speedConfigurationSchema,
15
17
  starLaserConfigureModuleOptionsSchema,
@@ -152,16 +154,32 @@ export const steeringWheelModuleCommandSchema = z.union([
152
154
  z.object({ module: z.literal('steeringWheel'), action: z.literal('turnLedOff') }),
153
155
  ]);
154
156
 
155
- // --- All Commands Union ---
156
- export const allCommandsConfigSchema = z.union([
157
- ballSensorDiskThrowerModuleCommandSchema,
158
- diskSensorBallShooterModuleCommandSchema,
159
- flagModuleCommandSchema,
160
- rgbModuleCommandSchema,
161
- speedModuleCommandSchema,
162
- leftStarBackLaserModuleCommandSchema,
163
- rightStarFrontLaserModuleCommandSchema,
164
- screenModuleCommandSchema,
165
- steeringWheelModuleCommandSchema,
166
- soundModuleCommandSchema,
157
+ // --- Emergency ---
158
+ export const emergencyModuleCommandSchema = z.union([
159
+ z.object({ module: z.literal('emergency'), action: z.literal('activate') }),
160
+ z.object({ module: z.literal('emergency'), action: z.literal('deactivate') }),
161
+ ]);
162
+
163
+ // --- Lights ---
164
+ export const lightsModuleCommandSchema = z.union([
165
+ z.object({ module: z.literal('lights'), action: z.literal('showColor'), params: showLightsColorParamsSchema }),
166
+ z.object({ module: z.literal('lights'), action: z.literal('showEffect'), params: showLightsEffectParamsSchema }),
167
167
  ]);
168
+
169
+ // --- All Commands Union ---
170
+ export const allCommandsConfigSchema = z
171
+ .union([
172
+ ballSensorDiskThrowerModuleCommandSchema,
173
+ diskSensorBallShooterModuleCommandSchema,
174
+ flagModuleCommandSchema,
175
+ rgbModuleCommandSchema,
176
+ speedModuleCommandSchema,
177
+ leftStarBackLaserModuleCommandSchema,
178
+ rightStarFrontLaserModuleCommandSchema,
179
+ screenModuleCommandSchema,
180
+ steeringWheelModuleCommandSchema,
181
+ soundModuleCommandSchema,
182
+ emergencyModuleCommandSchema,
183
+ lightsModuleCommandSchema,
184
+ ])
185
+ .and(z.object({ params: z.unknown().optional() }));
@@ -4,8 +4,10 @@ import {
4
4
  ballSensorDiskThrowerModuleCommandSchema,
5
5
  changeSpeedActionCommandOptionsSchema,
6
6
  diskSensorBallShooterModuleCommandSchema,
7
+ emergencyModuleCommandSchema,
7
8
  flagModuleCommandSchema,
8
9
  leftStarBackLaserModuleCommandSchema,
10
+ lightsModuleCommandSchema,
9
11
  playSoundActionCommandOptionsSchema,
10
12
  rgbModuleCommandSchema,
11
13
  rightStarFrontLaserModuleCommandSchema,
@@ -28,5 +30,7 @@ export type RightStarFrontLaserModuleCommands = z.infer<typeof rightStarFrontLas
28
30
  export type ScreenModuleCommands = z.infer<typeof screenModuleCommandSchema>;
29
31
  export type SteeringWheelModuleCommands = z.infer<typeof steeringWheelModuleCommandSchema>;
30
32
  export type SoundModuleCommands = z.infer<typeof soundModuleCommandSchema>;
33
+ export type EmergencyModuleCommands = z.infer<typeof emergencyModuleCommandSchema>;
34
+ export type LightsModuleCommands = z.infer<typeof lightsModuleCommandSchema>;
31
35
 
32
36
  export type AllCommandsConfig = z.infer<typeof allCommandsConfigSchema>;
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import { checkpointTypeSchema } from '../checkpoint/Checkpoint.schema';
3
- import { flagStatusSchema } from './flag/Flag.schema';
4
- import { rgbStatusSchema } from './rgb/RGB.schema';
5
- import { screenStatusSchema } from './screen/Screen.schema';
6
- import { speedStatusSchema } from './speed/Speed.schema';
3
+ import { flagStatusSchema } from './flag';
4
+ import { rgbStatusSchema } from './rgb';
5
+ import { screenStatusSchema } from './screen';
6
+ import { speedStatusSchema } from './speed';
7
7
 
8
8
  export const kartHardwareStateSchema = z.object({
9
9
  speed: z
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ import { kartHardwareStateSchema } from './KartHardwareState.schema';
3
+
4
+ export type KartHardwareState = z.infer<typeof kartHardwareStateSchema>;
@@ -3,9 +3,11 @@ import { ballSensorDiskThrowerModuleStatusSchema } from './ballSensor';
3
3
  import { diskSensorBallShooterModuleStatusSchema } from './diskSensor';
4
4
  import { emergencyModuleStatusSchema } from './emergency';
5
5
  import { flagModuleStatusSchema } from './flag';
6
+ import { lightsModuleStatusSchema } from './lights';
6
7
  import { MODULE_NAME } from './ModuleName.const';
7
8
  import { rgbModuleStatusSchema } from './rgb';
8
9
  import { speedModuleStatusSchema } from './speed';
10
+ import { screenModuleStatusSchema } from './screen';
9
11
  import { starLaserModuleStatusSchema } from './star-laser';
10
12
  import { steeringWheelModuleStatusSchema } from './steering-wheel';
11
13
 
@@ -20,4 +22,6 @@ export const moduleStatusSchema = z.union([
20
22
  starLaserModuleStatusSchema,
21
23
  steeringWheelModuleStatusSchema,
22
24
  emergencyModuleStatusSchema,
25
+ screenModuleStatusSchema,
26
+ lightsModuleStatusSchema,
23
27
  ]);
@@ -11,3 +11,9 @@ export const BALL_SENSOR_STATUS = {
11
11
  SENSOR_HIT: 'Sensor Hit',
12
12
  UNKNOWN: 'Unknown',
13
13
  } as const;
14
+
15
+ export const DISK_THROWER_COMMAND = {
16
+ ACTIVATE_THROWER: 'Activate Thrower',
17
+ DEACTIVATE_THROWER: 'Deactivate Thrower',
18
+ THROW_DISK: 'Throw Disk',
19
+ } as const;
@@ -1,8 +1,10 @@
1
1
  import { z } from 'zod';
2
- import { BALL_SENSOR_COMMAND, BALL_SENSOR_STATUS } from './BallSensor.const';
2
+ import { BALL_SENSOR_COMMAND, BALL_SENSOR_STATUS, DISK_THROWER_COMMAND } from './BallSensor.const';
3
3
 
4
4
  export const ballSensorCommandSchema = z.enum(BALL_SENSOR_COMMAND);
5
5
 
6
+ export const diskThrowerCommandSchema = z.enum(DISK_THROWER_COMMAND);
7
+
6
8
  export const ballSensorStatusSchema = z.enum(BALL_SENSOR_STATUS);
7
9
 
8
10
  export const configureBallSensorDiskThrowerModuleOptionsSchema = z.object({
@@ -4,9 +4,11 @@ import {
4
4
  ballSensorDiskThrowerModuleStatusSchema,
5
5
  ballSensorStatusSchema,
6
6
  configureBallSensorDiskThrowerModuleOptionsSchema,
7
+ diskThrowerCommandSchema,
7
8
  } from './BallSensor.schema';
8
9
 
9
10
  export type BallSensorCommand = z.infer<typeof ballSensorCommandSchema>;
11
+ export type DiskThrowerCommand = z.infer<typeof diskThrowerCommandSchema>;
10
12
  export type BallSensorStatus = z.infer<typeof ballSensorStatusSchema>;
11
13
  export type ConfigureBallSensorDiskThrowerModuleOptions = z.infer<
12
14
  typeof configureBallSensorDiskThrowerModuleOptionsSchema
@@ -82,3 +82,11 @@ export const FLAG_MEDIA_NAME = {
82
82
  STATIC_BEATING_HEART: 'static_beating_heart',
83
83
  STATIC_SPEED_PAD: 'static_speed_pad',
84
84
  } as const;
85
+
86
+ export const FLAG_ACTION_COMMAND = {
87
+ ACTIVATE: 'Activate',
88
+ DEACTIVATE: 'Deactivate',
89
+ SHOW_MEDIA_INDEFINITELY: 'Show Media Indefinitely',
90
+ SHOW_MEDIA_TEMPORARILY: 'Show Media Temporarily',
91
+ CONFIGURE: 'Configure',
92
+ } as const;
@@ -1,11 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { colorNameSchema } from '../../color';
3
3
  import { checkpointTypeSchema } from '../../checkpoint';
4
- import { FLAG_MEDIA_NAME, FLAG_STATUS } from './Flag.const';
4
+ import { FLAG_MEDIA_NAME, FLAG_STATUS, FLAG_ACTION_COMMAND } from './Flag.const';
5
5
 
6
6
  export const flagStatusSchema = z.enum(FLAG_STATUS);
7
7
 
8
- export const flagMediaNameSchema = z.enum(FLAG_MEDIA_NAME);
8
+ export const flagActionCommandSchema = z.enum(FLAG_ACTION_COMMAND);
9
+
10
+ export const flagMediaNameSchema = z
11
+ .union([z.number().min(0).max(255), z.enum(FLAG_MEDIA_NAME)])
12
+ .describe('The Media source could be the name of the icon on Flag Module or a number to render');
9
13
 
10
14
  export const flagModuleStatusSchema = z.object({
11
15
  flagStatus: flagStatusSchema,
@@ -5,9 +5,11 @@ import {
5
5
  flagModuleStatusSchema,
6
6
  flagShowMediaOptionsSchema,
7
7
  flagStatusSchema,
8
+ flagActionCommandSchema,
8
9
  } from './Flag.schema';
9
10
 
10
11
  export type FlagStatus = z.infer<typeof flagStatusSchema>;
12
+ export type FlagActionCommand = z.infer<typeof flagActionCommandSchema>;
11
13
  export type FlagMediaName = z.infer<typeof flagMediaNameSchema>;
12
14
  export type FlagModuleStatus = z.infer<typeof flagModuleStatusSchema>;
13
15
  export type FlagConfigurationOptions = z.infer<typeof flagConfigurationOptionsSchema>;
@@ -8,7 +8,8 @@ export * from './lights';
8
8
  export * from './ModuleName.const';
9
9
  export * from './ModuleStatus.schema';
10
10
  export * from './ModuleStatus.types';
11
- export * from './KartHardwareState.schema'; // Added
11
+ export * from './KartHardwareState.schema';
12
+ export * from './KartHardwareState.types';
12
13
  export * from './rgb';
13
14
  export * from './screen';
14
15
  export * from './sound';
@@ -9,3 +9,8 @@ export const LIGHTS_EFFECT = {
9
9
  RED_FLAG: 'RED_FLAG',
10
10
  PULSE: 'PULSE',
11
11
  } as const;
12
+
13
+ export const LIGHTS_ACTION_COMMAND = {
14
+ SHOW_COLOR: 'ShowColor',
15
+ SHOW_EFFECT: 'ShowEffect',
16
+ } as const;
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { LIGHTS_EFFECT } from './Lights.const';
2
+ import { LIGHTS_EFFECT, LIGHTS_ACTION_COMMAND } from './Lights.const';
3
+
4
+ export const lightsActionCommandSchema = z.enum(LIGHTS_ACTION_COMMAND);
3
5
 
4
6
  export const lightsEffectSchema = z.enum(LIGHTS_EFFECT);
5
7
 
@@ -14,3 +16,7 @@ export const showLightsEffectParamsSchema = z.object({
14
16
  effect: lightsEffectSchema,
15
17
  timeDuration: z.number().min(1).max(25),
16
18
  });
19
+
20
+ export const lightsModuleStatusSchema = z.object({
21
+ currentEffect: lightsEffectSchema.nullable(),
22
+ });
@@ -1,6 +1,14 @@
1
1
  import { z } from 'zod';
2
- import { lightsEffectSchema, showLightsColorParamsSchema, showLightsEffectParamsSchema } from './Lights.schema';
2
+ import {
3
+ lightsActionCommandSchema,
4
+ lightsEffectSchema,
5
+ lightsModuleStatusSchema,
6
+ showLightsColorParamsSchema,
7
+ showLightsEffectParamsSchema,
8
+ } from './Lights.schema';
3
9
 
10
+ export type LightsActionCommand = z.infer<typeof lightsActionCommandSchema>;
4
11
  export type LightsEffect = z.infer<typeof lightsEffectSchema>;
12
+ export type LightsModuleStatus = z.infer<typeof lightsModuleStatusSchema>;
5
13
  export type ShowLightsColorParams = z.infer<typeof showLightsColorParamsSchema>;
6
14
  export type ShowLightsEffectParams = z.infer<typeof showLightsEffectParamsSchema>;
@@ -6,3 +6,8 @@ export const RGB_STATUS = {
6
6
  UNKNOWN: 'Unknown',
7
7
  ERROR: 'Error',
8
8
  } as const;
9
+
10
+ export const RGB_ACTION_COMMANDS = {
11
+ EXEC: 'Exec',
12
+ CONFIGURE: 'Configure',
13
+ } as const;
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { colorNameSchema } from '../../color';
3
3
  import { kartEffectSchema } from '../../hardware/kart-effect';
4
- import { RGB_STATUS } from './RGB.const';
4
+ import { RGB_STATUS, RGB_ACTION_COMMANDS } from './RGB.const';
5
5
 
6
6
  export const rgbStatusSchema = z.enum(RGB_STATUS);
7
7
 
8
+ export const rgbActionCommandSchema = z.enum(RGB_ACTION_COMMANDS);
9
+
8
10
  export const rgbModuleStatusSchema = z.object({
9
11
  rgbStatus: rgbStatusSchema,
10
12
  kartColor: colorNameSchema,
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import {
3
+ rgbActionCommandSchema,
3
4
  rgbConfigurationOptionsSchema,
4
5
  rgbModuleStatusSchema,
5
6
  rgbShowEffectOptionsSchema,
@@ -10,3 +11,4 @@ export type RGBStatus = z.infer<typeof rgbStatusSchema>;
10
11
  export type RGBModuleStatus = z.infer<typeof rgbModuleStatusSchema>;
11
12
  export type RGBConfigurationOptions = z.infer<typeof rgbConfigurationOptionsSchema>;
12
13
  export type RGBShowEffectOptions = z.infer<typeof rgbShowEffectOptionsSchema>;
14
+ export type RGBActionCommand = z.infer<typeof rgbActionCommandSchema>;
@@ -1,3 +1,7 @@
1
1
  export const PLAY_SOUND_DURATION = {
2
2
  INFINITE: 'infinite',
3
3
  } as const;
4
+
5
+ export const SOUND_ACTION_COMMAND = {
6
+ PLAY: 'Play',
7
+ } as const;
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { soundNameSchema } from '../../sounds'; // Import from domains/sounds
3
- import { PLAY_SOUND_DURATION } from './Sound.const';
3
+ import { PLAY_SOUND_DURATION, SOUND_ACTION_COMMAND } from './Sound.const';
4
+
5
+ export const soundActionCommandSchema = z.enum(SOUND_ACTION_COMMAND);
4
6
 
5
7
  export const playSoundOptionsSchema = z.object({
6
8
  soundName: soundNameSchema,
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { playSoundOptionsSchema } from './Sound.schema';
2
+ import { soundActionCommandSchema, playSoundOptionsSchema } from './Sound.schema';
3
+
4
+ export type SoundActionCommand = z.infer<typeof soundActionCommandSchema>;
3
5
 
4
6
  export type PlaySoundOptions = z.infer<typeof playSoundOptionsSchema>;
@@ -0,0 +1,4 @@
1
+ export const STEERING_WHEEL_ACTION_COMMAND = {
2
+ TURN_LED_ON: 'TurnLedOn',
3
+ TURN_LED_OFF: 'TurnLedOff',
4
+ } as const;
@@ -1,4 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { STEERING_WHEEL_ACTION_COMMAND } from './SteeringWheel.const';
3
+
4
+ export const steeringWheelActionCommandSchema = z.enum(STEERING_WHEEL_ACTION_COMMAND);
2
5
 
3
6
  export const steeringWheelModuleStatusSchema = z.object({
4
7
  isLeftButtonPressed: z.boolean(),
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { steeringWheelModuleStatusSchema } from './SteeringWheel.schema';
2
+ import { steeringWheelActionCommandSchema, steeringWheelModuleStatusSchema } from './SteeringWheel.schema';
3
+
4
+ export type SteeringWheelActionCommand = z.infer<typeof steeringWheelActionCommandSchema>;
3
5
 
4
6
  export type SteeringWheelModuleStatus = z.infer<typeof steeringWheelModuleStatusSchema>;
@@ -5,3 +5,4 @@ export * from './SocketHardwareModulesEventsParams';
5
5
  export * from './SocketHardwareOnDataEventsParams';
6
6
  export * from './SocketPowerUpEventsParams';
7
7
  export * from './utils';
8
+ export * from './screen';
@@ -0,0 +1,19 @@
1
+ import type {
2
+ ScreenCountdownParams,
3
+ ScreenDebugViewInput,
4
+ ScreenFinishViewInput,
5
+ ScreenHomeViewInput,
6
+ ScreenUpdateGameViewInput,
7
+ } from '../../hardware';
8
+
9
+ /**
10
+ * Socket events from Raspberry Pi to Screen
11
+ */
12
+ export interface SocketScreenServerToClientEventsParams {
13
+ 'view:home': ScreenHomeViewInput;
14
+ 'view:countdown': ScreenCountdownParams;
15
+ 'game:sync_state': ScreenUpdateGameViewInput;
16
+ 'view:summary': ScreenFinishViewInput & { state: 'Victory' | 'Defeat' };
17
+ 'view:debug': ScreenDebugViewInput;
18
+ 'view:instruction_video': Record<string, never>;
19
+ }
@@ -0,0 +1 @@
1
+ export * from './SocketScreenServerToClientEventsParams';
@@ -85,6 +85,8 @@ export const gameTurnTaskSchema = z.object({
85
85
 
86
86
  export const gameTurnSchema = z.object({
87
87
  id: z.string(),
88
+ turnNumber: z.number().int().positive(),
89
+ groupName: z.string().optional(),
88
90
  purchaseId: z.string(),
89
91
  sessionId: z.string().optional(),
90
92
  leaderPlayerId: z.string(),
@@ -22,8 +22,8 @@ export const emailOrPhoneSchema = z
22
22
  const baseUserObj = z.object({
23
23
  id: z.uuidv4(),
24
24
 
25
- name: z.string(),
26
- lastName: z.string(),
25
+ name: z.string().optional(),
26
+ lastName: z.string().optional(),
27
27
 
28
28
  email: z.email().toLowerCase().optional().nullable(),
29
29
 
@@ -49,6 +49,19 @@ export const userSchema = baseUserObj.refine((data) => data.email || data.phoneN
49
49
  path: ['email', 'phoneNumber'],
50
50
  });
51
51
 
52
+ /**
53
+ * When a user registers, we don't have all the information, so we use this schema
54
+ */
55
+ export const initialUserSchema = baseUserObj.pick({
56
+ id: true,
57
+ email: true,
58
+ phoneNumber: true,
59
+ isEmailVerified: true,
60
+ isPhoneVerified: true,
61
+ type: true,
62
+ createdAt: true,
63
+ });
64
+
52
65
  /**
53
66
  * The schema for the user returned on login
54
67
  */
@@ -1,19 +1,21 @@
1
1
  import { z } from 'zod';
2
2
  import {
3
+ authUserSchema,
4
+ initialUserSchema,
5
+ userCompleteProfileSchema,
6
+ userInitialRegistrationSchema,
7
+ userLoginInputSchema,
3
8
  userSchema,
4
9
  userTypeSchema,
5
- userWithPasswordSchema,
6
- userInitialRegistrationSchema,
7
10
  userVerifySchema,
8
- userCompleteProfileSchema,
9
- userLoginInputSchema,
10
- authUserSchema,
11
+ userWithPasswordSchema,
11
12
  } from './User.schema';
12
13
 
13
14
  export type UserType = z.infer<typeof userTypeSchema>;
14
15
  export type User = z.infer<typeof userSchema>;
15
16
  export type UserWithPassword = z.infer<typeof userWithPasswordSchema>;
16
17
  export type AuthUser = z.infer<typeof authUserSchema>;
18
+ export type InitialUser = z.infer<typeof initialUserSchema>;
17
19
  export type UserInitialRegistration = z.infer<typeof userInitialRegistrationSchema>;
18
20
  export type UserVerify = z.infer<typeof userVerifySchema>;
19
21
  export type UserCompleteProfile = z.infer<typeof userCompleteProfileSchema>;