@battle-racing/br-common-lib 6.0.0 → 6.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,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm whoami *)",
5
+ "Bash(npm config *)"
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ export declare const COIN_TRANSACTION_TYPE: {
2
+ /** Coins given to the player when a game they played finished. */
3
+ readonly GAME_REWARD: "GAME_REWARD";
4
+ /** Manual correction made by the staff. */
5
+ readonly ADJUSTMENT: "ADJUSTMENT";
6
+ };
7
+ export declare const GAME_HISTORY_GROUP_BY: {
8
+ readonly DAY: "day";
9
+ readonly MONTH: "month";
10
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GAME_HISTORY_GROUP_BY = exports.COIN_TRANSACTION_TYPE = void 0;
4
+ exports.COIN_TRANSACTION_TYPE = {
5
+ /** Coins given to the player when a game they played finished. */
6
+ GAME_REWARD: 'GAME_REWARD',
7
+ /** Manual correction made by the staff. */
8
+ ADJUSTMENT: 'ADJUSTMENT',
9
+ };
10
+ exports.GAME_HISTORY_GROUP_BY = {
11
+ DAY: 'day',
12
+ MONTH: 'month',
13
+ };
@@ -0,0 +1,210 @@
1
+ import { z } from 'zod';
2
+ export declare const raceResultSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ gameId: z.ZodNumber;
5
+ gameTrackId: z.ZodString;
6
+ gameTurnId: z.ZodOptional<z.ZodString>;
7
+ playerId: z.ZodString;
8
+ playerNickname: z.ZodString;
9
+ kartGuid: z.ZodString;
10
+ position: z.ZodNumber;
11
+ totalKarts: z.ZodNumber;
12
+ isWinner: z.ZodBoolean;
13
+ coinsEarned: z.ZodNumber;
14
+ isOfficial: z.ZodBoolean;
15
+ finishedAt: z.ZodDate;
16
+ createdAt: z.ZodDate;
17
+ gameType: z.ZodLiteral<"Race">;
18
+ lapsCompleted: z.ZodNumber;
19
+ fastestLapMs: z.ZodNullable<z.ZodNumber>;
20
+ totalTimeMs: z.ZodNullable<z.ZodNumber>;
21
+ }, z.core.$strip>;
22
+ export declare const battleResultSchema: z.ZodObject<{
23
+ id: z.ZodString;
24
+ gameId: z.ZodNumber;
25
+ gameTrackId: z.ZodString;
26
+ gameTurnId: z.ZodOptional<z.ZodString>;
27
+ playerId: z.ZodString;
28
+ playerNickname: z.ZodString;
29
+ kartGuid: z.ZodString;
30
+ position: z.ZodNumber;
31
+ totalKarts: z.ZodNumber;
32
+ isWinner: z.ZodBoolean;
33
+ coinsEarned: z.ZodNumber;
34
+ isOfficial: z.ZodBoolean;
35
+ finishedAt: z.ZodDate;
36
+ createdAt: z.ZodDate;
37
+ gameType: z.ZodLiteral<"Battle">;
38
+ livesRemaining: z.ZodNumber;
39
+ wasEliminated: z.ZodBoolean;
40
+ }, z.core.$strip>;
41
+ export declare const gameResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ id: z.ZodString;
43
+ gameId: z.ZodNumber;
44
+ gameTrackId: z.ZodString;
45
+ gameTurnId: z.ZodOptional<z.ZodString>;
46
+ playerId: z.ZodString;
47
+ playerNickname: z.ZodString;
48
+ kartGuid: z.ZodString;
49
+ position: z.ZodNumber;
50
+ totalKarts: z.ZodNumber;
51
+ isWinner: z.ZodBoolean;
52
+ coinsEarned: z.ZodNumber;
53
+ isOfficial: z.ZodBoolean;
54
+ finishedAt: z.ZodDate;
55
+ createdAt: z.ZodDate;
56
+ gameType: z.ZodLiteral<"Race">;
57
+ lapsCompleted: z.ZodNumber;
58
+ fastestLapMs: z.ZodNullable<z.ZodNumber>;
59
+ totalTimeMs: z.ZodNullable<z.ZodNumber>;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ id: z.ZodString;
62
+ gameId: z.ZodNumber;
63
+ gameTrackId: z.ZodString;
64
+ gameTurnId: z.ZodOptional<z.ZodString>;
65
+ playerId: z.ZodString;
66
+ playerNickname: z.ZodString;
67
+ kartGuid: z.ZodString;
68
+ position: z.ZodNumber;
69
+ totalKarts: z.ZodNumber;
70
+ isWinner: z.ZodBoolean;
71
+ coinsEarned: z.ZodNumber;
72
+ isOfficial: z.ZodBoolean;
73
+ finishedAt: z.ZodDate;
74
+ createdAt: z.ZodDate;
75
+ gameType: z.ZodLiteral<"Battle">;
76
+ livesRemaining: z.ZodNumber;
77
+ wasEliminated: z.ZodBoolean;
78
+ }, z.core.$strip>], "gameType">;
79
+ export declare const filterGameHistorySchema: z.ZodObject<{
80
+ playerId: z.ZodOptional<z.ZodString>;
81
+ gameTrackId: z.ZodOptional<z.ZodString>;
82
+ gameType: z.ZodOptional<z.ZodEnum<{
83
+ readonly Race: "Race";
84
+ readonly Battle: "Battle";
85
+ }>>;
86
+ from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
87
+ to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
88
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
89
+ cursor: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ export declare const paginatedGameResultSchema: z.ZodObject<{
92
+ data: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
93
+ id: z.ZodString;
94
+ gameId: z.ZodNumber;
95
+ gameTrackId: z.ZodString;
96
+ gameTurnId: z.ZodOptional<z.ZodString>;
97
+ playerId: z.ZodString;
98
+ playerNickname: z.ZodString;
99
+ kartGuid: z.ZodString;
100
+ position: z.ZodNumber;
101
+ totalKarts: z.ZodNumber;
102
+ isWinner: z.ZodBoolean;
103
+ coinsEarned: z.ZodNumber;
104
+ isOfficial: z.ZodBoolean;
105
+ finishedAt: z.ZodDate;
106
+ createdAt: z.ZodDate;
107
+ gameType: z.ZodLiteral<"Race">;
108
+ lapsCompleted: z.ZodNumber;
109
+ fastestLapMs: z.ZodNullable<z.ZodNumber>;
110
+ totalTimeMs: z.ZodNullable<z.ZodNumber>;
111
+ }, z.core.$strip>, z.ZodObject<{
112
+ id: z.ZodString;
113
+ gameId: z.ZodNumber;
114
+ gameTrackId: z.ZodString;
115
+ gameTurnId: z.ZodOptional<z.ZodString>;
116
+ playerId: z.ZodString;
117
+ playerNickname: z.ZodString;
118
+ kartGuid: z.ZodString;
119
+ position: z.ZodNumber;
120
+ totalKarts: z.ZodNumber;
121
+ isWinner: z.ZodBoolean;
122
+ coinsEarned: z.ZodNumber;
123
+ isOfficial: z.ZodBoolean;
124
+ finishedAt: z.ZodDate;
125
+ createdAt: z.ZodDate;
126
+ gameType: z.ZodLiteral<"Battle">;
127
+ livesRemaining: z.ZodNumber;
128
+ wasEliminated: z.ZodBoolean;
129
+ }, z.core.$strip>], "gameType">>;
130
+ meta: z.ZodObject<{
131
+ nextCursor: z.ZodOptional<z.ZodString>;
132
+ hasMore: z.ZodOptional<z.ZodBoolean>;
133
+ limit: z.ZodNumber;
134
+ }, z.core.$strip>;
135
+ }, z.core.$strip>;
136
+ export declare const gameCountByPeriodSchema: z.ZodObject<{
137
+ period: z.ZodString;
138
+ count: z.ZodNumber;
139
+ }, z.core.$strip>;
140
+ export declare const gameHistoryStatsSchema: z.ZodObject<{
141
+ total: z.ZodNumber;
142
+ byGameType: z.ZodRecord<z.ZodEnum<{
143
+ readonly Race: "Race";
144
+ readonly Battle: "Battle";
145
+ }>, z.ZodNumber>;
146
+ byPeriod: z.ZodArray<z.ZodObject<{
147
+ period: z.ZodString;
148
+ count: z.ZodNumber;
149
+ }, z.core.$strip>>;
150
+ }, z.core.$strip>;
151
+ export declare const filterGameHistoryStatsSchema: z.ZodObject<{
152
+ gameTrackId: z.ZodOptional<z.ZodString>;
153
+ gameType: z.ZodOptional<z.ZodEnum<{
154
+ readonly Race: "Race";
155
+ readonly Battle: "Battle";
156
+ }>>;
157
+ from: z.ZodOptional<z.ZodCoercedDate<unknown>>;
158
+ to: z.ZodOptional<z.ZodCoercedDate<unknown>>;
159
+ groupBy: z.ZodDefault<z.ZodEnum<{
160
+ readonly DAY: "day";
161
+ readonly MONTH: "month";
162
+ }>>;
163
+ includeUnofficial: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
164
+ }, z.core.$strip>;
165
+ /** Append only ledger. Every change to a player wallet must leave one row here. */
166
+ export declare const coinTransactionSchema: z.ZodObject<{
167
+ id: z.ZodString;
168
+ playerId: z.ZodString;
169
+ amount: z.ZodNumber;
170
+ type: z.ZodEnum<{
171
+ readonly GAME_REWARD: "GAME_REWARD";
172
+ readonly ADJUSTMENT: "ADJUSTMENT";
173
+ }>;
174
+ balanceAfter: z.ZodNumber;
175
+ gameId: z.ZodOptional<z.ZodNumber>;
176
+ gameType: z.ZodOptional<z.ZodEnum<{
177
+ readonly Race: "Race";
178
+ readonly Battle: "Battle";
179
+ }>>;
180
+ note: z.ZodOptional<z.ZodString>;
181
+ createdAt: z.ZodDate;
182
+ }, z.core.$strip>;
183
+ export declare const filterCoinTransactionSchema: z.ZodObject<{
184
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
185
+ cursor: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strip>;
187
+ export declare const paginatedCoinTransactionSchema: z.ZodObject<{
188
+ data: z.ZodArray<z.ZodObject<{
189
+ id: z.ZodString;
190
+ playerId: z.ZodString;
191
+ amount: z.ZodNumber;
192
+ type: z.ZodEnum<{
193
+ readonly GAME_REWARD: "GAME_REWARD";
194
+ readonly ADJUSTMENT: "ADJUSTMENT";
195
+ }>;
196
+ balanceAfter: z.ZodNumber;
197
+ gameId: z.ZodOptional<z.ZodNumber>;
198
+ gameType: z.ZodOptional<z.ZodEnum<{
199
+ readonly Race: "Race";
200
+ readonly Battle: "Battle";
201
+ }>>;
202
+ note: z.ZodOptional<z.ZodString>;
203
+ createdAt: z.ZodDate;
204
+ }, z.core.$strip>>;
205
+ meta: z.ZodObject<{
206
+ nextCursor: z.ZodOptional<z.ZodString>;
207
+ hasMore: z.ZodOptional<z.ZodBoolean>;
208
+ limit: z.ZodNumber;
209
+ }, z.core.$strip>;
210
+ }, z.core.$strip>;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paginatedCoinTransactionSchema = exports.filterCoinTransactionSchema = exports.coinTransactionSchema = exports.filterGameHistoryStatsSchema = exports.gameHistoryStatsSchema = exports.gameCountByPeriodSchema = exports.paginatedGameResultSchema = exports.filterGameHistorySchema = exports.gameResultSchema = exports.battleResultSchema = exports.raceResultSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const Game_const_1 = require("../game/Game.const");
6
+ const Game_schema_1 = require("../game/Game.schema");
7
+ const pagination_1 = require("../pagination");
8
+ const GameHistory_const_1 = require("./GameHistory.const");
9
+ // --- Game Result Schemas ---
10
+ /**
11
+ * One row per (game, player). A game stores its players in `playerKartMap`, and a map
12
+ * cannot be queried by its keys, so per player history needs this flat collection.
13
+ */
14
+ const gameResultBaseSchema = zod_1.z.object({
15
+ /** `${gameType}-${gameId}-${playerId}`. Writing the same result twice does not duplicate it. */
16
+ id: zod_1.z.string(),
17
+ gameId: zod_1.z.number(),
18
+ gameTrackId: zod_1.z.string(),
19
+ gameTurnId: zod_1.z.string().optional(),
20
+ playerId: zod_1.z.string(),
21
+ /** Copied at the end of the game: nicknames are not unique and can change. */
22
+ playerNickname: zod_1.z.string(),
23
+ kartGuid: zod_1.z.string(),
24
+ position: zod_1.z.number().int(),
25
+ totalKarts: zod_1.z.number().int(),
26
+ isWinner: zod_1.z.boolean(),
27
+ /** Coin balance the player ended the game with. */
28
+ coinsEarned: zod_1.z.number().int(),
29
+ isOfficial: zod_1.z.boolean(),
30
+ finishedAt: zod_1.z.date(),
31
+ createdAt: zod_1.z.date(),
32
+ });
33
+ exports.raceResultSchema = gameResultBaseSchema.extend({
34
+ gameType: zod_1.z.literal(Game_const_1.GAME_TYPE.Race),
35
+ lapsCompleted: zod_1.z.number().int(),
36
+ /** Null when the player never completed a lap. */
37
+ fastestLapMs: zod_1.z.number().int().nullable(),
38
+ totalTimeMs: zod_1.z.number().int().nullable(),
39
+ });
40
+ exports.battleResultSchema = gameResultBaseSchema.extend({
41
+ gameType: zod_1.z.literal(Game_const_1.GAME_TYPE.Battle),
42
+ livesRemaining: zod_1.z.number().int(),
43
+ wasEliminated: zod_1.z.boolean(),
44
+ });
45
+ exports.gameResultSchema = zod_1.z.discriminatedUnion('gameType', [exports.raceResultSchema, exports.battleResultSchema]);
46
+ exports.filterGameHistorySchema = zod_1.z.object({
47
+ playerId: zod_1.z.string().optional(),
48
+ gameTrackId: zod_1.z.string().optional(),
49
+ gameType: Game_schema_1.gameTypeSchema.optional(),
50
+ from: zod_1.z.coerce.date().optional(),
51
+ to: zod_1.z.coerce.date().optional(),
52
+ limit: zod_1.z.coerce.number().min(1).max(100).default(20),
53
+ cursor: zod_1.z.string().optional(),
54
+ });
55
+ exports.paginatedGameResultSchema = (0, pagination_1.paginatedResponseSchema)(exports.gameResultSchema);
56
+ // --- Staff Counter Schemas ---
57
+ exports.gameCountByPeriodSchema = zod_1.z.object({
58
+ /** `YYYY-MM-DD` when grouping by day, `YYYY-MM` when grouping by month. */
59
+ period: zod_1.z.string(),
60
+ count: zod_1.z.number().int(),
61
+ });
62
+ exports.gameHistoryStatsSchema = zod_1.z.object({
63
+ total: zod_1.z.number().int(),
64
+ byGameType: zod_1.z.record(Game_schema_1.gameTypeSchema, zod_1.z.number().int()),
65
+ byPeriod: zod_1.z.array(exports.gameCountByPeriodSchema),
66
+ });
67
+ exports.filterGameHistoryStatsSchema = zod_1.z.object({
68
+ gameTrackId: zod_1.z.string().optional(),
69
+ gameType: Game_schema_1.gameTypeSchema.optional(),
70
+ from: zod_1.z.coerce.date().optional(),
71
+ to: zod_1.z.coerce.date().optional(),
72
+ groupBy: zod_1.z.enum(GameHistory_const_1.GAME_HISTORY_GROUP_BY).default(GameHistory_const_1.GAME_HISTORY_GROUP_BY.DAY),
73
+ /** Operator test games are left out unless this is set. */
74
+ includeUnofficial: zod_1.z.coerce.boolean().default(false),
75
+ });
76
+ // --- Coin Transaction Schemas ---
77
+ /** Append only ledger. Every change to a player wallet must leave one row here. */
78
+ exports.coinTransactionSchema = zod_1.z.object({
79
+ id: zod_1.z.string(),
80
+ playerId: zod_1.z.string(),
81
+ /** Positive when the player earns coins, negative when they spend them. */
82
+ amount: zod_1.z.number().int(),
83
+ type: zod_1.z.enum(GameHistory_const_1.COIN_TRANSACTION_TYPE),
84
+ balanceAfter: zod_1.z.number().int(),
85
+ gameId: zod_1.z.number().optional(),
86
+ gameType: Game_schema_1.gameTypeSchema.optional(),
87
+ note: zod_1.z.string().optional(),
88
+ createdAt: zod_1.z.date(),
89
+ });
90
+ exports.filterCoinTransactionSchema = zod_1.z.object({
91
+ limit: zod_1.z.coerce.number().min(1).max(100).default(20),
92
+ cursor: zod_1.z.string().optional(),
93
+ });
94
+ exports.paginatedCoinTransactionSchema = (0, pagination_1.paginatedResponseSchema)(exports.coinTransactionSchema);
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { coinTransactionSchema, filterCoinTransactionSchema, filterGameHistorySchema, filterGameHistoryStatsSchema, gameCountByPeriodSchema, gameHistoryStatsSchema, battleResultSchema, gameResultSchema, paginatedCoinTransactionSchema, paginatedGameResultSchema, raceResultSchema } from './GameHistory.schema';
3
+ export type RaceResult = z.infer<typeof raceResultSchema>;
4
+ export type BattleResult = z.infer<typeof battleResultSchema>;
5
+ export type GameResult = z.infer<typeof gameResultSchema>;
6
+ export type FilterGameHistory = z.infer<typeof filterGameHistorySchema>;
7
+ export type PaginatedGameResult = z.infer<typeof paginatedGameResultSchema>;
8
+ export type GameCountByPeriod = z.infer<typeof gameCountByPeriodSchema>;
9
+ export type GameHistoryStats = z.infer<typeof gameHistoryStatsSchema>;
10
+ export type FilterGameHistoryStats = z.infer<typeof filterGameHistoryStatsSchema>;
11
+ export type CoinTransaction = z.infer<typeof coinTransactionSchema>;
12
+ export type FilterCoinTransaction = z.infer<typeof filterCoinTransactionSchema>;
13
+ export type PaginatedCoinTransaction = z.infer<typeof paginatedCoinTransactionSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './GameHistory.const';
2
+ export * from './GameHistory.schema';
3
+ export * from './GameHistory.types';
@@ -0,0 +1,19 @@
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("./GameHistory.const"), exports);
18
+ __exportStar(require("./GameHistory.schema"), exports);
19
+ __exportStar(require("./GameHistory.types"), exports);
@@ -52,10 +52,11 @@ export declare const kartHardwareStateSchema: z.ZodObject<{
52
52
  steeringWheel: z.ZodNullable<z.ZodObject<{
53
53
  ledStatus: z.ZodEnum<{
54
54
  readonly OFF: "Off";
55
- readonly IDLE: "Idle";
56
- readonly POWER_UP: "Power-Up";
57
- readonly EMERGENCY: "Emergency";
55
+ readonly COLOR: "Color";
56
+ readonly EFFECT: "Effect";
58
57
  readonly CONFIG: "Config";
58
+ readonly ERROR: "Error";
59
+ readonly UNKNOWN: "Unknown";
59
60
  }>;
60
61
  buttons: z.ZodObject<{
61
62
  powerRightPressed: z.ZodBoolean;
@@ -109,10 +109,11 @@ export declare const moduleStatusSchema: z.ZodUnion<readonly [z.ZodObject<{
109
109
  }, z.core.$strip>, z.ZodObject<{
110
110
  ledStatus: z.ZodEnum<{
111
111
  readonly OFF: "Off";
112
- readonly IDLE: "Idle";
113
- readonly POWER_UP: "Power-Up";
114
- readonly EMERGENCY: "Emergency";
112
+ readonly COLOR: "Color";
113
+ readonly EFFECT: "Effect";
115
114
  readonly CONFIG: "Config";
115
+ readonly ERROR: "Error";
116
+ readonly UNKNOWN: "Unknown";
116
117
  }>;
117
118
  buttons: z.ZodObject<{
118
119
  powerRightPressed: z.ZodBoolean;
@@ -52,10 +52,11 @@ export declare const screenDebugViewInputSchema: z.ZodObject<{
52
52
  steeringWheel: z.ZodNullable<z.ZodObject<{
53
53
  ledStatus: z.ZodEnum<{
54
54
  readonly OFF: "Off";
55
- readonly IDLE: "Idle";
56
- readonly POWER_UP: "Power-Up";
57
- readonly EMERGENCY: "Emergency";
55
+ readonly COLOR: "Color";
56
+ readonly EFFECT: "Effect";
58
57
  readonly CONFIG: "Config";
58
+ readonly ERROR: "Error";
59
+ readonly UNKNOWN: "Unknown";
59
60
  }>;
60
61
  buttons: z.ZodObject<{
61
62
  powerRightPressed: z.ZodBoolean;
@@ -6,15 +6,26 @@ export declare const STEERING_WHEEL_ACTION_COMMAND: {
6
6
  readonly CONFIGURE_LEDS: "ConfigureLeds";
7
7
  };
8
8
  export declare const STEERING_WHEEL_SHOW_LED_EFFECT_OPTIONS: {
9
- readonly SHOW_LED_IDLE_EFFECT: "ShowLedIdleEffect";
10
- readonly SHOW_LED_POWERUP_EFFECT: "ShowLedPowerupEffect";
11
- readonly SHOW_LED_EMERGENCY_EFFECT: "ShowLedEmergencyEffect";
12
- readonly SHOW_LED_CONFIG_EFFECT: "ShowLedConfigEffect";
9
+ readonly SHOW_COLOR: "ShowColor";
10
+ readonly STAR: "Star";
11
+ readonly RAY: "Ray";
12
+ readonly RAY_HIT: "RayHit";
13
+ readonly SPEED_BOOST: "SpeedBoost";
14
+ readonly CHARGED_POWER: "ChargedPower";
15
+ readonly ROULETTE: "Roulette";
16
+ readonly SHIELD: "Shield";
17
+ readonly BROKEN_SHIELD: "BrokenShield";
18
+ readonly WAIT: "Wait";
19
+ readonly STANDARD: "Standard";
20
+ readonly POWER_UP: "PowerUp";
21
+ readonly EMERGENCY: "Emergency";
22
+ readonly TRAFFIC_LIGHT: "TrafficLight";
13
23
  };
14
24
  export declare const STEERING_WHEEL_LED_STATUS: {
15
25
  readonly OFF: "Off";
16
- readonly IDLE: "Idle";
17
- readonly POWER_UP: "Power-Up";
18
- readonly EMERGENCY: "Emergency";
26
+ readonly COLOR: "Color";
27
+ readonly EFFECT: "Effect";
19
28
  readonly CONFIG: "Config";
29
+ readonly ERROR: "Error";
30
+ readonly UNKNOWN: "Unknown";
20
31
  };
@@ -9,15 +9,26 @@ exports.STEERING_WHEEL_ACTION_COMMAND = {
9
9
  CONFIGURE_LEDS: 'ConfigureLeds',
10
10
  };
11
11
  exports.STEERING_WHEEL_SHOW_LED_EFFECT_OPTIONS = {
12
- SHOW_LED_IDLE_EFFECT: 'ShowLedIdleEffect',
13
- SHOW_LED_POWERUP_EFFECT: 'ShowLedPowerupEffect',
14
- SHOW_LED_EMERGENCY_EFFECT: 'ShowLedEmergencyEffect',
15
- SHOW_LED_CONFIG_EFFECT: 'ShowLedConfigEffect',
12
+ SHOW_COLOR: 'ShowColor',
13
+ STAR: 'Star',
14
+ RAY: 'Ray',
15
+ RAY_HIT: 'RayHit',
16
+ SPEED_BOOST: 'SpeedBoost',
17
+ CHARGED_POWER: 'ChargedPower',
18
+ ROULETTE: 'Roulette',
19
+ SHIELD: 'Shield',
20
+ BROKEN_SHIELD: 'BrokenShield',
21
+ WAIT: 'Wait',
22
+ STANDARD: 'Standard',
23
+ POWER_UP: 'PowerUp',
24
+ EMERGENCY: 'Emergency',
25
+ TRAFFIC_LIGHT: 'TrafficLight',
16
26
  };
17
27
  exports.STEERING_WHEEL_LED_STATUS = {
18
28
  OFF: 'Off',
19
- IDLE: 'Idle',
20
- POWER_UP: 'Power-Up',
21
- EMERGENCY: 'Emergency',
29
+ COLOR: 'Color',
30
+ EFFECT: 'Effect',
22
31
  CONFIG: 'Config',
32
+ ERROR: 'Error',
33
+ UNKNOWN: 'Unknown',
23
34
  };
@@ -7,18 +7,20 @@ export declare const steeringWheelActionCommandSchema: z.ZodEnum<{
7
7
  }>;
8
8
  export declare const steeringWheelLedStatusSchema: z.ZodEnum<{
9
9
  readonly OFF: "Off";
10
- readonly IDLE: "Idle";
11
- readonly POWER_UP: "Power-Up";
12
- readonly EMERGENCY: "Emergency";
10
+ readonly COLOR: "Color";
11
+ readonly EFFECT: "Effect";
13
12
  readonly CONFIG: "Config";
13
+ readonly ERROR: "Error";
14
+ readonly UNKNOWN: "Unknown";
14
15
  }>;
15
16
  export declare const steeringWheelModuleStatusSchema: z.ZodObject<{
16
17
  ledStatus: z.ZodEnum<{
17
18
  readonly OFF: "Off";
18
- readonly IDLE: "Idle";
19
- readonly POWER_UP: "Power-Up";
20
- readonly EMERGENCY: "Emergency";
19
+ readonly COLOR: "Color";
20
+ readonly EFFECT: "Effect";
21
21
  readonly CONFIG: "Config";
22
+ readonly ERROR: "Error";
23
+ readonly UNKNOWN: "Unknown";
22
24
  }>;
23
25
  buttons: z.ZodObject<{
24
26
  powerRightPressed: z.ZodBoolean;
@@ -30,12 +32,36 @@ export declare const steeringWheelModuleStatusSchema: z.ZodObject<{
30
32
  }, z.core.$strip>;
31
33
  }, z.core.$strip>;
32
34
  export declare const steeringWheelShowLedsEffectOptionsSchema: z.ZodEnum<{
33
- readonly SHOW_LED_IDLE_EFFECT: "ShowLedIdleEffect";
34
- readonly SHOW_LED_POWERUP_EFFECT: "ShowLedPowerupEffect";
35
- readonly SHOW_LED_EMERGENCY_EFFECT: "ShowLedEmergencyEffect";
36
- readonly SHOW_LED_CONFIG_EFFECT: "ShowLedConfigEffect";
35
+ readonly SHOW_COLOR: "ShowColor";
36
+ readonly STAR: "Star";
37
+ readonly RAY: "Ray";
38
+ readonly RAY_HIT: "RayHit";
39
+ readonly SPEED_BOOST: "SpeedBoost";
40
+ readonly CHARGED_POWER: "ChargedPower";
41
+ readonly ROULETTE: "Roulette";
42
+ readonly SHIELD: "Shield";
43
+ readonly BROKEN_SHIELD: "BrokenShield";
44
+ readonly WAIT: "Wait";
45
+ readonly STANDARD: "Standard";
46
+ readonly POWER_UP: "PowerUp";
47
+ readonly EMERGENCY: "Emergency";
48
+ readonly TRAFFIC_LIGHT: "TrafficLight";
37
49
  }>;
38
50
  export declare const steeringWheelConfigureLedsOptionsSchema: z.ZodObject<{
39
51
  brightness: z.ZodNumber;
40
52
  durationSeconds: z.ZodNumber;
53
+ colorBody: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
54
+ readonly Black: "Black";
55
+ readonly Red: "Red";
56
+ readonly Blue: "Blue";
57
+ readonly Green: "Green";
58
+ readonly Yellow: "Yellow";
59
+ readonly Violet: "Violet";
60
+ readonly Cyan: "Cyan";
61
+ readonly Magenta: "Magenta";
62
+ readonly Orange: "Orange";
63
+ readonly White: "White";
64
+ readonly GreenYellow: "GreenYellow";
65
+ readonly SaddleBrown: "SaddleBrown";
66
+ }>>>;
41
67
  }, z.core.$strip>;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.steeringWheelConfigureLedsOptionsSchema = exports.steeringWheelShowLedsEffectOptionsSchema = exports.steeringWheelModuleStatusSchema = exports.steeringWheelLedStatusSchema = exports.steeringWheelActionCommandSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const Color_schema_1 = require("../../color/Color.schema");
6
+ const Color_const_1 = require("../../color/Color.const");
5
7
  const SteeringWheel_const_1 = require("./SteeringWheel.const");
6
8
  exports.steeringWheelActionCommandSchema = zod_1.z.enum(SteeringWheel_const_1.STEERING_WHEEL_ACTION_COMMAND);
7
9
  exports.steeringWheelLedStatusSchema = zod_1.z.enum(SteeringWheel_const_1.STEERING_WHEEL_LED_STATUS);
@@ -20,4 +22,5 @@ exports.steeringWheelShowLedsEffectOptionsSchema = zod_1.z.enum(SteeringWheel_co
20
22
  exports.steeringWheelConfigureLedsOptionsSchema = zod_1.z.object({
21
23
  brightness: zod_1.z.number().min(0).max(100),
22
24
  durationSeconds: zod_1.z.number().min(1).max(25),
25
+ colorBody: Color_schema_1.colorNameSchema.optional().default(Color_const_1.COLOR_NAME.Red),
23
26
  });
@@ -116,10 +116,11 @@ export declare const kartSchema: z.ZodObject<{
116
116
  steeringWheel: z.ZodNullable<z.ZodObject<{
117
117
  ledStatus: z.ZodEnum<{
118
118
  readonly OFF: "Off";
119
- readonly IDLE: "Idle";
120
- readonly POWER_UP: "Power-Up";
121
- readonly EMERGENCY: "Emergency";
119
+ readonly COLOR: "Color";
120
+ readonly EFFECT: "Effect";
122
121
  readonly CONFIG: "Config";
122
+ readonly ERROR: "Error";
123
+ readonly UNKNOWN: "Unknown";
123
124
  }>;
124
125
  buttons: z.ZodObject<{
125
126
  powerRightPressed: z.ZodBoolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -7,16 +7,27 @@ export const STEERING_WHEEL_ACTION_COMMAND = {
7
7
  } as const;
8
8
 
9
9
  export const STEERING_WHEEL_SHOW_LED_EFFECT_OPTIONS = {
10
- SHOW_LED_IDLE_EFFECT: 'ShowLedIdleEffect',
11
- SHOW_LED_POWERUP_EFFECT: 'ShowLedPowerupEffect',
12
- SHOW_LED_EMERGENCY_EFFECT: 'ShowLedEmergencyEffect',
13
- SHOW_LED_CONFIG_EFFECT: 'ShowLedConfigEffect',
10
+ SHOW_COLOR: 'ShowColor',
11
+ STAR: 'Star',
12
+ RAY: 'Ray',
13
+ RAY_HIT: 'RayHit',
14
+ SPEED_BOOST: 'SpeedBoost',
15
+ CHARGED_POWER: 'ChargedPower',
16
+ ROULETTE: 'Roulette',
17
+ SHIELD: 'Shield',
18
+ BROKEN_SHIELD: 'BrokenShield',
19
+ WAIT: 'Wait',
20
+ STANDARD: 'Standard',
21
+ POWER_UP: 'PowerUp',
22
+ EMERGENCY: 'Emergency',
23
+ TRAFFIC_LIGHT: 'TrafficLight',
14
24
  } as const;
15
25
 
16
26
  export const STEERING_WHEEL_LED_STATUS = {
17
27
  OFF: 'Off',
18
- IDLE: 'Idle',
19
- POWER_UP: 'Power-Up',
20
- EMERGENCY: 'Emergency',
28
+ COLOR: 'Color',
29
+ EFFECT: 'Effect',
21
30
  CONFIG: 'Config',
31
+ ERROR: 'Error',
32
+ UNKNOWN: 'Unknown',
22
33
  } as const;
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { colorNameSchema } from '../../color/Color.schema';
3
+ import { COLOR_NAME } from '../../color/Color.const';
2
4
  import {
3
5
  STEERING_WHEEL_ACTION_COMMAND,
4
6
  STEERING_WHEEL_LED_STATUS,
@@ -25,4 +27,5 @@ export const steeringWheelShowLedsEffectOptionsSchema = z.enum(STEERING_WHEEL_SH
25
27
  export const steeringWheelConfigureLedsOptionsSchema = z.object({
26
28
  brightness: z.number().min(0).max(100),
27
29
  durationSeconds: z.number().min(1).max(25),
30
+ colorBody: colorNameSchema.optional().default(COLOR_NAME.Red),
28
31
  });