@battle-racing/br-common-lib 2.4.1 → 3.0.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 (35) hide show
  1. package/dist/constants/hardware/index.d.ts +2 -0
  2. package/dist/constants/hardware/index.js +2 -0
  3. package/dist/constants/hardware/screen-status.d.ts +7 -0
  4. package/dist/constants/hardware/screen-status.js +8 -0
  5. package/dist/constants/hardware/screen-view.d.ts +9 -0
  6. package/dist/constants/hardware/screen-view.js +12 -0
  7. package/dist/types/hardware/KartHardwareState.d.ts +2 -0
  8. package/dist/types/hardware/screen/ScreenModuleStatus.d.ts +6 -0
  9. package/dist/types/hardware/screen/ScreenModuleStatus.js +2 -0
  10. package/dist/types/hardware/screen/ScreenStatus.d.ts +3 -0
  11. package/dist/types/hardware/screen/ScreenStatus.js +2 -0
  12. package/dist/types/hardware/screen/ScreenView.d.ts +3 -1
  13. package/dist/types/hardware/screen/index.d.ts +2 -0
  14. package/dist/types/hardware/screen/index.js +2 -0
  15. package/dist/types/response/Response.d.ts +2 -2
  16. package/dist/types/response/SuccesResponse.d.ts +1 -1
  17. package/dist/types/response/SuccessResponse.d.ts +5 -0
  18. package/dist/types/response/SuccessResponse.js +2 -0
  19. package/dist/types/response/index.d.ts +1 -1
  20. package/dist/types/socket/SocketHardwareOnDataEventsParams.d.ts +2 -1
  21. package/dist/types/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +4 -1
  22. package/package.json +1 -1
  23. package/src/constants/hardware/index.ts +2 -0
  24. package/src/constants/hardware/screen-status.ts +6 -0
  25. package/src/constants/hardware/screen-view.ts +9 -0
  26. package/src/types/hardware/KartHardwareState.ts +2 -0
  27. package/src/types/hardware/screen/ScreenModuleStatus.ts +7 -0
  28. package/src/types/hardware/screen/ScreenStatus.ts +4 -0
  29. package/src/types/hardware/screen/ScreenView.ts +4 -1
  30. package/src/types/hardware/screen/index.ts +2 -0
  31. package/src/types/response/Response.ts +2 -2
  32. package/src/types/response/{SuccesResponse.ts → SuccessResponse.ts} +1 -1
  33. package/src/types/response/index.ts +1 -1
  34. package/src/types/socket/SocketHardwareOnDataEventsParams.ts +2 -0
  35. package/src/types/socket/serverToClient/SocketKartServerToClientEventsParams.ts +1 -1
@@ -4,4 +4,6 @@ export * from './flag-media-name';
4
4
  export * from './flag-status';
5
5
  export * from './lights-effect';
6
6
  export * from './rgb-status';
7
+ export * from './screen-status';
8
+ export * from './screen-view';
7
9
  export * from './speed-status';
@@ -20,4 +20,6 @@ __exportStar(require("./flag-media-name"), exports);
20
20
  __exportStar(require("./flag-status"), exports);
21
21
  __exportStar(require("./lights-effect"), exports);
22
22
  __exportStar(require("./rgb-status"), exports);
23
+ __exportStar(require("./screen-status"), exports);
24
+ __exportStar(require("./screen-view"), exports);
23
25
  __exportStar(require("./speed-status"), exports);
@@ -0,0 +1,7 @@
1
+ export declare const SCREEN_STATUS: {
2
+ readonly DEBUG: "Debug";
3
+ readonly ACTIVATED: "Activated";
4
+ readonly DEACTIVATED: "Deactivated";
5
+ readonly UNKNOWN: "Unknown";
6
+ readonly ERROR: "Error";
7
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SCREEN_STATUS = void 0;
4
+ const base_hardware_status_1 = require("./base-hardware-status");
5
+ exports.SCREEN_STATUS = {
6
+ ...base_hardware_status_1.BASE_HARDWARE_STATUS,
7
+ DEBUG: 'Debug',
8
+ };
@@ -0,0 +1,9 @@
1
+ export declare const SCREEN_VIEW: {
2
+ readonly HOME: "Home";
3
+ readonly COUNTDOWN: "Countdown";
4
+ readonly RACE: "Race";
5
+ readonly GAME_SUMMARY: "GameSummary";
6
+ readonly INSTRUCTION_VIDEO: "InstructionVideo";
7
+ readonly BATTLE: "Battle";
8
+ readonly DEBUG: "Debug";
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SCREEN_VIEW = void 0;
4
+ exports.SCREEN_VIEW = {
5
+ HOME: 'Home',
6
+ COUNTDOWN: 'Countdown',
7
+ RACE: 'Race',
8
+ GAME_SUMMARY: 'GameSummary',
9
+ INSTRUCTION_VIDEO: 'InstructionVideo',
10
+ BATTLE: 'Battle',
11
+ DEBUG: 'Debug',
12
+ };
@@ -1,10 +1,12 @@
1
1
  import type { FlagStatus } from './flag';
2
2
  import type { RGBStatus } from './rgb';
3
+ import type { ScreenStatus } from './screen';
3
4
  import type { SpeedStatus } from './speed';
4
5
  export type KartHardwareState = {
5
6
  speed: SpeedStatus | null;
6
7
  rgb: RGBStatus | null;
7
8
  flag: FlagStatus | null;
9
+ screen: ScreenStatus | null;
8
10
  isConnectedToServer: boolean;
9
11
  isSteeringWheelPressed: boolean;
10
12
  };
@@ -0,0 +1,6 @@
1
+ import { ScreenStatus } from './ScreenStatus';
2
+ import { ScreenView } from './ScreenView';
3
+ export interface ScreenModuleStatus {
4
+ latestView: ScreenView;
5
+ screenStatus: ScreenStatus;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { SCREEN_STATUS } from '../../../constants';
2
+ import { ObjectValues } from '../../utils';
3
+ export type ScreenStatus = ObjectValues<typeof SCREEN_STATUS>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,3 @@
1
- export type ScreenView = 'Home' | 'Countdown' | 'Race' | 'Battle' | 'Victory' | 'Defeat';
1
+ import { SCREEN_VIEW } from '../../../constants';
2
+ import { ObjectValues } from '../../utils';
3
+ export type ScreenView = ObjectValues<typeof SCREEN_VIEW>;
@@ -4,7 +4,9 @@ export * from './ScreenDebugViewInput';
4
4
  export * from './ScreenFinishViewInput';
5
5
  export * from './ScreenGameTimeLeft';
6
6
  export * from './ScreenHomeViewInput';
7
+ export * from './ScreenModuleStatus';
7
8
  export * from './ScreenRaceViewConfig';
9
+ export * from './ScreenStatus';
8
10
  export * from './ScreenUpdateGameViewInput';
9
11
  export * from './ScreenView';
10
12
  export * from './ScreenViewBaseConfig';
@@ -20,7 +20,9 @@ __exportStar(require("./ScreenDebugViewInput"), exports);
20
20
  __exportStar(require("./ScreenFinishViewInput"), exports);
21
21
  __exportStar(require("./ScreenGameTimeLeft"), exports);
22
22
  __exportStar(require("./ScreenHomeViewInput"), exports);
23
+ __exportStar(require("./ScreenModuleStatus"), exports);
23
24
  __exportStar(require("./ScreenRaceViewConfig"), exports);
25
+ __exportStar(require("./ScreenStatus"), exports);
24
26
  __exportStar(require("./ScreenUpdateGameViewInput"), exports);
25
27
  __exportStar(require("./ScreenView"), exports);
26
28
  __exportStar(require("./ScreenViewBaseConfig"), exports);
@@ -1,3 +1,3 @@
1
1
  import type { ErrorResponse } from './ErrorResponse';
2
- import type { SuccesResponse } from './SuccesResponse';
3
- export type Response<T> = SuccesResponse<T> | ErrorResponse;
2
+ import type { SuccessResponse } from './SuccessResponse';
3
+ export type Response<T> = SuccessResponse<T> | ErrorResponse;
@@ -1,4 +1,4 @@
1
- export interface SuccesResponse<T> {
1
+ export interface SuccessResponse<T> {
2
2
  status: 'success';
3
3
  code: 200;
4
4
  data?: T;
@@ -0,0 +1,5 @@
1
+ export interface SuccessResponse<T> {
2
+ status: 'success';
3
+ code: 200;
4
+ data?: T;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
1
  export type { ErrorResponse } from './ErrorResponse';
2
- export type { SuccesResponse } from './SuccesResponse';
2
+ export type { SuccessResponse } from './SuccessResponse';
3
3
  export type { Response } from './Response';
@@ -1,4 +1,4 @@
1
- import type { BallSensorDiskThrowerModuleStatus, DiskSensorBallShooterModuleStatus, EmergencyModuleStatus, FlagModuleStatus, RGBModuleStatus, SpeedModuleStatus, StarLaserModuleStatus, SteeringWheelModuleStatus } from '../hardware';
1
+ import type { BallSensorDiskThrowerModuleStatus, DiskSensorBallShooterModuleStatus, EmergencyModuleStatus, FlagModuleStatus, RGBModuleStatus, ScreenModuleStatus, SpeedModuleStatus, StarLaserModuleStatus, SteeringWheelModuleStatus } from '../hardware';
2
2
  /** Data that are triggered from Hardware Modules of Kart */
3
3
  export type SocketHardwareOnDataEventsParams = {
4
4
  'hardware:disk-sensor-ball-shooter:onModuleStatus': DiskSensorBallShooterModuleStatus;
@@ -9,6 +9,7 @@ export type SocketHardwareOnDataEventsParams = {
9
9
  'hardware:left-star-back-laser:onModuleStatus': StarLaserModuleStatus;
10
10
  'hardware:right-star-front-laser:onModuleStatus': StarLaserModuleStatus;
11
11
  'hardware:steering-wheel:onModuleStatus': SteeringWheelModuleStatus;
12
+ 'hardware:screen:onModuleStatus': ScreenModuleStatus;
12
13
  };
13
14
  /** Data that are triggered from Hardware Modules of Game Track */
14
15
  export type SocketGameTrackHardwareOnDataEventsParams = {
@@ -14,7 +14,10 @@ export interface SocketKartEventsParams {
14
14
  'kart:updated': {
15
15
  kart: Kart;
16
16
  };
17
- 'kart:init:response': Response<Kart>;
17
+ 'kart:init:response': Response<{
18
+ kart: Kart;
19
+ gameTrack: GameTrack;
20
+ }>;
18
21
  /** Whenever the Game Track config changed */
19
22
  'kart:gameTrack:updated': {
20
23
  gameTrack: GameTrack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "2.4.1",
3
+ "version": "3.0.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -4,4 +4,6 @@ export * from './flag-media-name';
4
4
  export * from './flag-status';
5
5
  export * from './lights-effect';
6
6
  export * from './rgb-status';
7
+ export * from './screen-status';
8
+ export * from './screen-view';
7
9
  export * from './speed-status';
@@ -0,0 +1,6 @@
1
+ import { BASE_HARDWARE_STATUS } from './base-hardware-status';
2
+
3
+ export const SCREEN_STATUS = {
4
+ ...BASE_HARDWARE_STATUS,
5
+ DEBUG: 'Debug',
6
+ } as const;
@@ -0,0 +1,9 @@
1
+ export const SCREEN_VIEW = {
2
+ HOME: 'Home',
3
+ COUNTDOWN: 'Countdown',
4
+ RACE: 'Race',
5
+ GAME_SUMMARY: 'GameSummary',
6
+ INSTRUCTION_VIDEO: 'InstructionVideo',
7
+ BATTLE: 'Battle',
8
+ DEBUG: 'Debug',
9
+ } as const;
@@ -1,11 +1,13 @@
1
1
  import type { FlagStatus } from './flag';
2
2
  import type { RGBStatus } from './rgb';
3
+ import type { ScreenStatus } from './screen';
3
4
  import type { SpeedStatus } from './speed';
4
5
 
5
6
  export type KartHardwareState = {
6
7
  speed: SpeedStatus | null;
7
8
  rgb: RGBStatus | null;
8
9
  flag: FlagStatus | null;
10
+ screen: ScreenStatus | null;
9
11
  isConnectedToServer: boolean;
10
12
  isSteeringWheelPressed: boolean;
11
13
  };
@@ -0,0 +1,7 @@
1
+ import { ScreenStatus } from './ScreenStatus';
2
+ import { ScreenView } from './ScreenView';
3
+
4
+ export interface ScreenModuleStatus {
5
+ latestView: ScreenView;
6
+ screenStatus: ScreenStatus;
7
+ }
@@ -0,0 +1,4 @@
1
+ import { SCREEN_STATUS } from '../../../constants';
2
+ import { ObjectValues } from '../../utils';
3
+
4
+ export type ScreenStatus = ObjectValues<typeof SCREEN_STATUS>;
@@ -1 +1,4 @@
1
- export type ScreenView = 'Home' | 'Countdown' | 'Race' | 'Battle' | 'Victory' | 'Defeat';
1
+ import { SCREEN_VIEW } from '../../../constants';
2
+ import { ObjectValues } from '../../utils';
3
+
4
+ export type ScreenView = ObjectValues<typeof SCREEN_VIEW>;
@@ -4,7 +4,9 @@ export * from './ScreenDebugViewInput';
4
4
  export * from './ScreenFinishViewInput';
5
5
  export * from './ScreenGameTimeLeft';
6
6
  export * from './ScreenHomeViewInput';
7
+ export * from './ScreenModuleStatus';
7
8
  export * from './ScreenRaceViewConfig';
9
+ export * from './ScreenStatus';
8
10
  export * from './ScreenUpdateGameViewInput';
9
11
  export * from './ScreenView';
10
12
  export * from './ScreenViewBaseConfig';
@@ -1,4 +1,4 @@
1
1
  import type { ErrorResponse } from './ErrorResponse';
2
- import type { SuccesResponse } from './SuccesResponse';
2
+ import type { SuccessResponse } from './SuccessResponse';
3
3
 
4
- export type Response<T> = SuccesResponse<T> | ErrorResponse;
4
+ export type Response<T> = SuccessResponse<T> | ErrorResponse;
@@ -1,4 +1,4 @@
1
- export interface SuccesResponse<T> {
1
+ export interface SuccessResponse<T> {
2
2
  status: 'success';
3
3
  code: 200;
4
4
  data?: T;
@@ -1,3 +1,3 @@
1
1
  export type { ErrorResponse } from './ErrorResponse';
2
- export type { SuccesResponse } from './SuccesResponse';
2
+ export type { SuccessResponse } from './SuccessResponse';
3
3
  export type { Response } from './Response';
@@ -4,6 +4,7 @@ import type {
4
4
  EmergencyModuleStatus,
5
5
  FlagModuleStatus,
6
6
  RGBModuleStatus,
7
+ ScreenModuleStatus,
7
8
  SpeedModuleStatus,
8
9
  StarLaserModuleStatus,
9
10
  SteeringWheelModuleStatus,
@@ -19,6 +20,7 @@ export type SocketHardwareOnDataEventsParams = {
19
20
  'hardware:left-star-back-laser:onModuleStatus': StarLaserModuleStatus;
20
21
  'hardware:right-star-front-laser:onModuleStatus': StarLaserModuleStatus;
21
22
  'hardware:steering-wheel:onModuleStatus': SteeringWheelModuleStatus;
23
+ 'hardware:screen:onModuleStatus': ScreenModuleStatus;
22
24
  };
23
25
 
24
26
  /** Data that are triggered from Hardware Modules of Game Track */
@@ -17,7 +17,7 @@ export type SocketKartPowerUpEventsParams = {
17
17
  export interface SocketKartEventsParams {
18
18
  'kart:updated': { kart: Kart };
19
19
  // Response from server
20
- 'kart:init:response': Response<Kart>;
20
+ 'kart:init:response': Response<{ kart: Kart; gameTrack: GameTrack }>;
21
21
  /** Whenever the Game Track config changed */
22
22
  'kart:gameTrack:updated': { gameTrack: GameTrack };
23
23
  /** When the physical button of the game track is pressed */