@battle-racing/br-common-lib 6.2.0-rc.8 → 6.2.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 (75) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/dist/data/all-tutorial-steps.js +37 -0
  3. package/dist/domains/arcade/Arcade.const.d.ts +9 -0
  4. package/dist/domains/arcade/Arcade.const.js +12 -0
  5. package/dist/domains/arcade/Arcade.schema.d.ts +83 -0
  6. package/dist/domains/arcade/Arcade.schema.js +48 -0
  7. package/dist/domains/arcade/Arcade.types.d.ts +11 -0
  8. package/dist/domains/arcade/Arcade.types.js +2 -0
  9. package/dist/domains/arcade/index.d.ts +3 -0
  10. package/dist/domains/arcade/index.js +19 -0
  11. package/dist/domains/command/Command.schema.d.ts +24 -4
  12. package/dist/domains/command/Command.schema.js +10 -2
  13. package/dist/domains/flow/Flow.schema.d.ts +10 -2
  14. package/dist/domains/game/Game.schema.d.ts +1 -1
  15. package/dist/domains/game/Game.schema.js +1 -1
  16. package/dist/domains/game/battle/Battle.schema.d.ts +1 -2
  17. package/dist/domains/game/battle/Battle.schema.js +0 -1
  18. package/dist/domains/game/race/Race.schema.d.ts +2 -3
  19. package/dist/domains/game/race/Race.schema.js +0 -1
  20. package/dist/domains/gameTrack/GameTrack.schema.d.ts +4 -0
  21. package/dist/domains/gameTrack/GameTrack.schema.js +2 -0
  22. package/dist/domains/hardware/KartHardwareState.schema.d.ts +4 -1
  23. package/dist/domains/hardware/KartHardwareState.schema.js +2 -1
  24. package/dist/domains/hardware/ModuleStatus.schema.d.ts +5 -0
  25. package/dist/domains/hardware/rgb/RGB.const.d.ts +4 -0
  26. package/dist/domains/hardware/rgb/RGB.const.js +5 -1
  27. package/dist/domains/hardware/rgb/RGB.schema.d.ts +21 -0
  28. package/dist/domains/hardware/rgb/RGB.schema.js +8 -1
  29. package/dist/domains/hardware/rgb/RGB.types.d.ts +3 -1
  30. package/dist/domains/hardware/screen/ScreenDebug.schema.d.ts +4 -1
  31. package/dist/domains/kart/Kart.schema.d.ts +4 -1
  32. package/dist/domains/powerUp/PowerUp.schema.d.ts +30 -6
  33. package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.d.ts +13 -0
  34. package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.js +2 -0
  35. package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.d.ts +7 -0
  36. package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.js +10 -0
  37. package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.d.ts +9 -0
  38. package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.js +2 -0
  39. package/dist/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.d.ts +4 -0
  40. package/dist/domains/socket/utils/SocketParamsToEventsWithAck.d.ts +5 -0
  41. package/dist/domains/socket/utils/SocketParamsToEventsWithAck.js +2 -0
  42. package/dist/domains/tutorial/Tutorial.const.d.ts +0 -2
  43. package/dist/domains/tutorial/Tutorial.const.js +1 -16
  44. package/dist/domains/tutorial/Tutorial.schema.d.ts +45 -31
  45. package/dist/domains/tutorial/Tutorial.schema.js +21 -23
  46. package/dist/domains/tutorial/Tutorial.types.d.ts +4 -2
  47. package/dist/domains/tutorial/TutorialConfig.schema.d.ts +33 -6
  48. package/dist/domains/tutorial/TutorialConfig.schema.js +1 -0
  49. package/dist/domains/utils/Utils.schema.d.ts +2 -0
  50. package/dist/domains/utils/Utils.schema.js +8 -3
  51. package/dist/domains/wallet/Wallet.const.d.ts +4 -0
  52. package/dist/domains/wallet/Wallet.const.js +7 -0
  53. package/dist/domains/wallet/Wallet.schema.d.ts +57 -0
  54. package/dist/domains/wallet/Wallet.schema.js +43 -0
  55. package/dist/domains/wallet/Wallet.types.d.ts +9 -0
  56. package/dist/domains/wallet/Wallet.types.js +2 -0
  57. package/dist/domains/wallet/index.d.ts +3 -0
  58. package/dist/domains/wallet/index.js +19 -0
  59. package/package.json +1 -1
  60. package/src/data/all-tutorial-steps.ts +41 -0
  61. package/src/domains/command/Command.schema.ts +10 -2
  62. package/src/domains/game/Game.schema.ts +1 -1
  63. package/src/domains/game/battle/Battle.schema.ts +0 -1
  64. package/src/domains/game/race/Race.schema.ts +0 -1
  65. package/src/domains/gameTrack/GameTrack.schema.ts +2 -0
  66. package/src/domains/hardware/KartHardwareState.schema.ts +3 -2
  67. package/src/domains/hardware/rgb/RGB.const.ts +5 -0
  68. package/src/domains/hardware/rgb/RGB.schema.ts +10 -1
  69. package/src/domains/hardware/rgb/RGB.types.ts +4 -0
  70. package/src/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.ts +2 -0
  71. package/src/domains/tutorial/Tutorial.const.ts +0 -16
  72. package/src/domains/tutorial/Tutorial.schema.ts +22 -22
  73. package/src/domains/tutorial/Tutorial.types.ts +6 -3
  74. package/src/domains/tutorial/TutorialConfig.schema.ts +1 -0
  75. package/src/domains/utils/Utils.schema.ts +8 -3
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm whoami *)",
5
+ "Bash(npm config *)"
6
+ ]
7
+ }
8
+ }
@@ -14,6 +14,23 @@ const nitroTutorialHud = {
14
14
  ...defaultTutorialHud,
15
15
  powerUp: domains_1.POWER_UP_NAME.BATTLE_NITRO,
16
16
  };
17
+ const startDrivingCommands = [
18
+ { module: 'speed', action: 'activate' },
19
+ { module: 'speed', action: 'change', params: { speed: '$kart.tutorialSpeed', forUnlimitedTime: true } },
20
+ ];
21
+ const stopKartCommands = [
22
+ { module: 'speed', action: 'change', params: { speed: 0, forUnlimitedTime: true } },
23
+ { module: 'speed', action: 'deactivate' },
24
+ ];
25
+ // The step fires the nitro, after it ends the speed module goes back to its default speed
26
+ const returnToFinishCommands = [
27
+ {
28
+ module: 'speed',
29
+ action: 'configure',
30
+ params: { defaultSpeed: '$kart.tutorialReturnSpeed', timeDuration: '$kart.powerUpTime' },
31
+ },
32
+ { module: 'speed', action: 'activate' },
33
+ ];
17
34
  exports.allTutorialConfig = {
18
35
  id: 'tutorial-master-v1',
19
36
  name: 'Standard Circuit Induction Tutorial',
@@ -33,6 +50,7 @@ exports.allTutorialConfig = {
33
50
  durationMs: 5000,
34
51
  },
35
52
  triggerCommands: [
53
+ ...stopKartCommands,
36
54
  {
37
55
  module: 'screen',
38
56
  action: 'showTutorialView',
@@ -52,6 +70,7 @@ exports.allTutorialConfig = {
52
70
  durationMs: 6000,
53
71
  },
54
72
  triggerCommands: [
73
+ ...stopKartCommands,
55
74
  {
56
75
  module: 'screen',
57
76
  action: 'showTutorialView',
@@ -78,6 +97,7 @@ exports.allTutorialConfig = {
78
97
  durationMs: 4000,
79
98
  },
80
99
  triggerCommands: [
100
+ ...stopKartCommands,
81
101
  {
82
102
  module: 'screen',
83
103
  action: 'showTutorialView',
@@ -97,6 +117,7 @@ exports.allTutorialConfig = {
97
117
  durationMs: 5000,
98
118
  },
99
119
  triggerCommands: [
120
+ ...stopKartCommands,
100
121
  {
101
122
  module: 'screen',
102
123
  action: 'showTutorialView',
@@ -116,6 +137,7 @@ exports.allTutorialConfig = {
116
137
  durationMs: 6000,
117
138
  },
118
139
  triggerCommands: [
140
+ ...startDrivingCommands,
119
141
  {
120
142
  module: 'screen',
121
143
  action: 'showTutorialView',
@@ -142,6 +164,7 @@ exports.allTutorialConfig = {
142
164
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
143
165
  },
144
166
  triggerCommands: [
167
+ ...startDrivingCommands,
145
168
  {
146
169
  module: 'screen',
147
170
  action: 'showTutorialView',
@@ -169,6 +192,7 @@ exports.allTutorialConfig = {
169
192
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
170
193
  },
171
194
  triggerCommands: [
195
+ ...stopKartCommands,
172
196
  {
173
197
  module: 'screen',
174
198
  action: 'showTutorialView',
@@ -188,6 +212,7 @@ exports.allTutorialConfig = {
188
212
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
189
213
  },
190
214
  triggerCommands: [
215
+ ...stopKartCommands,
191
216
  {
192
217
  module: 'screen',
193
218
  action: 'showTutorialView',
@@ -207,6 +232,7 @@ exports.allTutorialConfig = {
207
232
  durationMs: 4000,
208
233
  },
209
234
  triggerCommands: [
235
+ ...stopKartCommands,
210
236
  {
211
237
  module: 'screen',
212
238
  action: 'showTutorialView',
@@ -226,6 +252,7 @@ exports.allTutorialConfig = {
226
252
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
227
253
  },
228
254
  triggerCommands: [
255
+ ...startDrivingCommands,
229
256
  {
230
257
  module: 'screen',
231
258
  action: 'showTutorialView',
@@ -246,6 +273,7 @@ exports.allTutorialConfig = {
246
273
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
247
274
  },
248
275
  triggerCommands: [
276
+ ...stopKartCommands,
249
277
  {
250
278
  module: 'screen',
251
279
  action: 'showTutorialView',
@@ -266,6 +294,7 @@ exports.allTutorialConfig = {
266
294
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
267
295
  },
268
296
  triggerCommands: [
297
+ ...stopKartCommands,
269
298
  {
270
299
  module: 'screen',
271
300
  action: 'showTutorialView',
@@ -286,6 +315,7 @@ exports.allTutorialConfig = {
286
315
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
287
316
  },
288
317
  triggerCommands: [
318
+ ...stopKartCommands,
289
319
  {
290
320
  module: 'screen',
291
321
  action: 'showTutorialView',
@@ -306,6 +336,7 @@ exports.allTutorialConfig = {
306
336
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
307
337
  },
308
338
  triggerCommands: [
339
+ ...stopKartCommands,
309
340
  {
310
341
  module: 'screen',
311
342
  action: 'showTutorialView',
@@ -333,6 +364,7 @@ exports.allTutorialConfig = {
333
364
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
334
365
  },
335
366
  triggerCommands: [
367
+ ...startDrivingCommands,
336
368
  {
337
369
  module: 'screen',
338
370
  action: 'showTutorialView',
@@ -353,6 +385,7 @@ exports.allTutorialConfig = {
353
385
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
354
386
  },
355
387
  triggerCommands: [
388
+ ...stopKartCommands,
356
389
  {
357
390
  module: 'screen',
358
391
  action: 'showTutorialView',
@@ -373,6 +406,7 @@ exports.allTutorialConfig = {
373
406
  button: domains_1.TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
374
407
  },
375
408
  triggerCommands: [
409
+ ...startDrivingCommands,
376
410
  {
377
411
  module: 'screen',
378
412
  action: 'showTutorialView',
@@ -388,11 +422,13 @@ exports.allTutorialConfig = {
388
422
  index: 3,
389
423
  name: 'Nitro Fired - Return to HUD',
390
424
  screenStep: domains_1.TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
425
+ executePowerUpId: 'battle-nitro',
391
426
  listenEvent: {
392
427
  on: domains_1.TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
393
428
  target: domains_1.TUTORIAL_CHECKPOINT_TARGET.FINISH,
394
429
  },
395
430
  triggerCommands: [
431
+ ...returnToFinishCommands,
396
432
  {
397
433
  module: 'screen',
398
434
  action: 'showTutorialView',
@@ -420,6 +456,7 @@ exports.allTutorialConfig = {
420
456
  durationMs: 5000,
421
457
  },
422
458
  triggerCommands: [
459
+ ...stopKartCommands,
423
460
  {
424
461
  module: 'screen',
425
462
  action: 'showTutorialView',
@@ -0,0 +1,9 @@
1
+ export declare const ARCADE_SESSION_STATUS: {
2
+ readonly ACTIVE: "ACTIVE";
3
+ readonly FINISHED: "FINISHED";
4
+ readonly ABANDONED: "ABANDONED";
5
+ };
6
+ export declare const ARCADE_SESSION_ORIGIN: {
7
+ readonly QR: "QR";
8
+ readonly ANONYMOUS: "ANONYMOUS";
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ARCADE_SESSION_ORIGIN = exports.ARCADE_SESSION_STATUS = void 0;
4
+ exports.ARCADE_SESSION_STATUS = {
5
+ ACTIVE: 'ACTIVE',
6
+ FINISHED: 'FINISHED',
7
+ ABANDONED: 'ABANDONED',
8
+ };
9
+ exports.ARCADE_SESSION_ORIGIN = {
10
+ QR: 'QR',
11
+ ANONYMOUS: 'ANONYMOUS',
12
+ };
@@ -0,0 +1,83 @@
1
+ import { z } from 'zod';
2
+ export declare const arcadeSessionStatusSchema: z.ZodEnum<{
3
+ readonly ACTIVE: "ACTIVE";
4
+ readonly FINISHED: "FINISHED";
5
+ readonly ABANDONED: "ABANDONED";
6
+ }>;
7
+ export declare const arcadeSessionOriginSchema: z.ZodEnum<{
8
+ readonly QR: "QR";
9
+ readonly ANONYMOUS: "ANONYMOUS";
10
+ }>;
11
+ /** Readable id printed in the machine QR, e.g. "marble-table-01" */
12
+ export declare const arcadeMachineIdSchema: z.ZodString;
13
+ export declare const arcadeMachineSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ maxCoinsDelta: z.ZodNumber;
17
+ isActive: z.ZodDefault<z.ZodBoolean>;
18
+ createdAt: z.ZodDate;
19
+ }, z.core.$strip>;
20
+ export declare const createArcadeMachineInputSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ name: z.ZodString;
23
+ maxCoinsDelta: z.ZodNumber;
24
+ }, z.core.$strip>;
25
+ export declare const qrArcadeSessionSchema: z.ZodObject<{
26
+ id: z.ZodUUID;
27
+ machineId: z.ZodString;
28
+ status: z.ZodEnum<{
29
+ readonly ACTIVE: "ACTIVE";
30
+ readonly FINISHED: "FINISHED";
31
+ readonly ABANDONED: "ABANDONED";
32
+ }>;
33
+ coinsDelta: z.ZodOptional<z.ZodNumber>;
34
+ startedAt: z.ZodDate;
35
+ finishedAt: z.ZodOptional<z.ZodDate>;
36
+ origin: z.ZodLiteral<"QR">;
37
+ userId: z.ZodUUID;
38
+ startingBalance: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ export declare const anonymousArcadeSessionSchema: z.ZodObject<{
41
+ id: z.ZodUUID;
42
+ machineId: z.ZodString;
43
+ status: z.ZodEnum<{
44
+ readonly ACTIVE: "ACTIVE";
45
+ readonly FINISHED: "FINISHED";
46
+ readonly ABANDONED: "ABANDONED";
47
+ }>;
48
+ coinsDelta: z.ZodOptional<z.ZodNumber>;
49
+ startedAt: z.ZodDate;
50
+ finishedAt: z.ZodOptional<z.ZodDate>;
51
+ origin: z.ZodLiteral<"ANONYMOUS">;
52
+ }, z.core.$strip>;
53
+ export declare const arcadeSessionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
54
+ id: z.ZodUUID;
55
+ machineId: z.ZodString;
56
+ status: z.ZodEnum<{
57
+ readonly ACTIVE: "ACTIVE";
58
+ readonly FINISHED: "FINISHED";
59
+ readonly ABANDONED: "ABANDONED";
60
+ }>;
61
+ coinsDelta: z.ZodOptional<z.ZodNumber>;
62
+ startedAt: z.ZodDate;
63
+ finishedAt: z.ZodOptional<z.ZodDate>;
64
+ origin: z.ZodLiteral<"QR">;
65
+ userId: z.ZodUUID;
66
+ startingBalance: z.ZodNumber;
67
+ }, z.core.$strip>, z.ZodObject<{
68
+ id: z.ZodUUID;
69
+ machineId: z.ZodString;
70
+ status: z.ZodEnum<{
71
+ readonly ACTIVE: "ACTIVE";
72
+ readonly FINISHED: "FINISHED";
73
+ readonly ABANDONED: "ABANDONED";
74
+ }>;
75
+ coinsDelta: z.ZodOptional<z.ZodNumber>;
76
+ startedAt: z.ZodDate;
77
+ finishedAt: z.ZodOptional<z.ZodDate>;
78
+ origin: z.ZodLiteral<"ANONYMOUS">;
79
+ }, z.core.$strip>], "origin">;
80
+ export declare const finishArcadeSessionInputSchema: z.ZodObject<{
81
+ sessionId: z.ZodUUID;
82
+ coinsDelta: z.ZodNumber;
83
+ }, z.core.$strip>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.finishArcadeSessionInputSchema = exports.arcadeSessionSchema = exports.anonymousArcadeSessionSchema = exports.qrArcadeSessionSchema = exports.createArcadeMachineInputSchema = exports.arcadeMachineSchema = exports.arcadeMachineIdSchema = exports.arcadeSessionOriginSchema = exports.arcadeSessionStatusSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const wallet_1 = require("../wallet");
6
+ const Arcade_const_1 = require("./Arcade.const");
7
+ exports.arcadeSessionStatusSchema = zod_1.z.enum(Arcade_const_1.ARCADE_SESSION_STATUS);
8
+ exports.arcadeSessionOriginSchema = zod_1.z.enum(Arcade_const_1.ARCADE_SESSION_ORIGIN);
9
+ /** Readable id printed in the machine QR, e.g. "marble-table-01" */
10
+ exports.arcadeMachineIdSchema = zod_1.z
11
+ .string()
12
+ .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Machine id must use lowercase letters, numbers and dashes');
13
+ exports.arcadeMachineSchema = zod_1.z.object({
14
+ id: exports.arcadeMachineIdSchema,
15
+ name: zod_1.z.string().min(1),
16
+ maxCoinsDelta: wallet_1.coinsAmountSchema.positive(),
17
+ isActive: zod_1.z.boolean().default(true),
18
+ createdAt: zod_1.z.date(),
19
+ });
20
+ exports.createArcadeMachineInputSchema = exports.arcadeMachineSchema.pick({
21
+ id: true,
22
+ name: true,
23
+ maxCoinsDelta: true,
24
+ });
25
+ const baseArcadeSessionSchema = zod_1.z.object({
26
+ id: zod_1.z.uuidv4(),
27
+ machineId: exports.arcadeMachineIdSchema,
28
+ status: exports.arcadeSessionStatusSchema,
29
+ coinsDelta: wallet_1.coinsAmountSchema.optional(),
30
+ startedAt: zod_1.z.date(),
31
+ finishedAt: zod_1.z.date().optional(),
32
+ });
33
+ exports.qrArcadeSessionSchema = baseArcadeSessionSchema.extend({
34
+ origin: zod_1.z.literal(Arcade_const_1.ARCADE_SESSION_ORIGIN.QR),
35
+ userId: zod_1.z.uuidv4(),
36
+ startingBalance: wallet_1.coinsAmountSchema.nonnegative(),
37
+ });
38
+ exports.anonymousArcadeSessionSchema = baseArcadeSessionSchema.extend({
39
+ origin: zod_1.z.literal(Arcade_const_1.ARCADE_SESSION_ORIGIN.ANONYMOUS),
40
+ });
41
+ exports.arcadeSessionSchema = zod_1.z.discriminatedUnion('origin', [
42
+ exports.qrArcadeSessionSchema,
43
+ exports.anonymousArcadeSessionSchema,
44
+ ]);
45
+ exports.finishArcadeSessionInputSchema = zod_1.z.object({
46
+ sessionId: zod_1.z.uuidv4(),
47
+ coinsDelta: wallet_1.coinsAmountSchema,
48
+ });
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { anonymousArcadeSessionSchema, arcadeMachineIdSchema, arcadeMachineSchema, arcadeSessionOriginSchema, arcadeSessionSchema, arcadeSessionStatusSchema, createArcadeMachineInputSchema, finishArcadeSessionInputSchema, qrArcadeSessionSchema } from './Arcade.schema';
3
+ export type ArcadeSessionStatus = z.infer<typeof arcadeSessionStatusSchema>;
4
+ export type ArcadeSessionOrigin = z.infer<typeof arcadeSessionOriginSchema>;
5
+ export type ArcadeMachineId = z.infer<typeof arcadeMachineIdSchema>;
6
+ export type ArcadeMachine = z.infer<typeof arcadeMachineSchema>;
7
+ export type CreateArcadeMachineInput = z.infer<typeof createArcadeMachineInputSchema>;
8
+ export type QrArcadeSession = z.infer<typeof qrArcadeSessionSchema>;
9
+ export type AnonymousArcadeSession = z.infer<typeof anonymousArcadeSessionSchema>;
10
+ export type ArcadeSession = z.infer<typeof arcadeSessionSchema>;
11
+ export type FinishArcadeSessionInput = z.infer<typeof finishArcadeSessionInputSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './Arcade.const';
2
+ export * from './Arcade.schema';
3
+ export * from './Arcade.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("./Arcade.const"), exports);
18
+ __exportStar(require("./Arcade.schema"), exports);
19
+ __exportStar(require("./Arcade.types"), exports);
@@ -3,6 +3,10 @@ export declare const changeSpeedActionCommandOptionsSchema: z.ZodObject<{
3
3
  forUnlimitedTime: z.ZodOptional<z.ZodBoolean>;
4
4
  speed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
5
5
  }, z.core.$strip>;
6
+ export declare const configureSpeedActionCommandOptionsSchema: z.ZodObject<{
7
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
8
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
9
+ }, z.core.$strip>;
6
10
  export declare const speedModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
7
11
  module: z.ZodLiteral<"speed">;
8
12
  action: z.ZodLiteral<"activate">;
@@ -20,8 +24,8 @@ export declare const speedModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<
20
24
  module: z.ZodLiteral<"speed">;
21
25
  action: z.ZodLiteral<"configure">;
22
26
  params: z.ZodObject<{
23
- defaultSpeed: z.ZodNumber;
24
- timeDuration: z.ZodNumber;
27
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
28
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
25
29
  }, z.core.$strip>;
26
30
  }, z.core.$strip>]>;
27
31
  export declare const playSoundActionCommandOptionsSchema: z.ZodObject<{
@@ -332,6 +336,10 @@ export declare const rgbModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
332
336
  }>;
333
337
  brightness: z.ZodNumber;
334
338
  effectTime: z.ZodNumber;
339
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
340
+ readonly FRONT: "front";
341
+ readonly BACK: "back";
342
+ }>>>;
335
343
  }, z.core.$strip>;
336
344
  }, z.core.$strip>, z.ZodObject<{
337
345
  module: z.ZodLiteral<"rgb">;
@@ -357,6 +365,10 @@ export declare const rgbModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
357
365
  readonly EMERGENCY_EFFECT: "Emergency Effect";
358
366
  readonly WAIT_EFFECT: "Wait Effect";
359
367
  }>;
368
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
369
+ readonly FRONT: "front";
370
+ readonly BACK: "back";
371
+ }>>>;
360
372
  }, z.core.$strip>;
361
373
  }, z.core.$strip>]>;
362
374
  export declare const leftStarBackLaserModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -1267,6 +1279,10 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1267
1279
  }>;
1268
1280
  brightness: z.ZodNumber;
1269
1281
  effectTime: z.ZodNumber;
1282
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1283
+ readonly FRONT: "front";
1284
+ readonly BACK: "back";
1285
+ }>>>;
1270
1286
  }, z.core.$strip>;
1271
1287
  }, z.core.$strip>, z.ZodObject<{
1272
1288
  module: z.ZodLiteral<"rgb">;
@@ -1292,6 +1308,10 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1292
1308
  readonly EMERGENCY_EFFECT: "Emergency Effect";
1293
1309
  readonly WAIT_EFFECT: "Wait Effect";
1294
1310
  }>;
1311
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1312
+ readonly FRONT: "front";
1313
+ readonly BACK: "back";
1314
+ }>>>;
1295
1315
  }, z.core.$strip>;
1296
1316
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1297
1317
  module: z.ZodLiteral<"speed">;
@@ -1310,8 +1330,8 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1310
1330
  module: z.ZodLiteral<"speed">;
1311
1331
  action: z.ZodLiteral<"configure">;
1312
1332
  params: z.ZodObject<{
1313
- defaultSpeed: z.ZodNumber;
1314
- timeDuration: z.ZodNumber;
1333
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1334
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
1315
1335
  }, z.core.$strip>;
1316
1336
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1317
1337
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.allCommandsConfigSchema = exports.lightsModuleCommandSchema = exports.emergencyModuleCommandSchema = exports.steeringWheelModuleCommandSchema = exports.screenModuleCommandSchema = exports.rightStarFrontLaserModuleCommandSchema = exports.leftStarBackLaserModuleCommandSchema = exports.rgbModuleCommandSchema = exports.flagModuleCommandSchema = exports.diskSensorBallShooterModuleCommandSchema = exports.ballSensorDiskThrowerModuleCommandSchema = exports.soundModuleCommandSchema = exports.playSoundActionCommandOptionsSchema = exports.speedModuleCommandSchema = exports.changeSpeedActionCommandOptionsSchema = void 0;
3
+ exports.allCommandsConfigSchema = exports.lightsModuleCommandSchema = exports.emergencyModuleCommandSchema = exports.steeringWheelModuleCommandSchema = exports.screenModuleCommandSchema = exports.rightStarFrontLaserModuleCommandSchema = exports.leftStarBackLaserModuleCommandSchema = exports.rgbModuleCommandSchema = exports.flagModuleCommandSchema = exports.diskSensorBallShooterModuleCommandSchema = exports.ballSensorDiskThrowerModuleCommandSchema = exports.soundModuleCommandSchema = exports.playSoundActionCommandOptionsSchema = exports.speedModuleCommandSchema = exports.configureSpeedActionCommandOptionsSchema = exports.changeSpeedActionCommandOptionsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const hardware_1 = require("../hardware");
6
6
  const utils_1 = require("../utils");
@@ -10,11 +10,19 @@ const arithmeticOrNumberSchema = zod_1.z.union([zod_1.z.number(), utils_1.arithm
10
10
  exports.changeSpeedActionCommandOptionsSchema = hardware_1.speedChangeOptionsSchema.omit({ speed: true }).extend({
11
11
  speed: arithmeticOrNumberSchema,
12
12
  });
13
+ exports.configureSpeedActionCommandOptionsSchema = zod_1.z.object({
14
+ defaultSpeed: arithmeticOrNumberSchema,
15
+ timeDuration: arithmeticOrNumberSchema,
16
+ });
13
17
  exports.speedModuleCommandSchema = zod_1.z.union([
14
18
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('activate') }),
15
19
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('deactivate') }),
16
20
  zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('change'), params: exports.changeSpeedActionCommandOptionsSchema }),
17
- zod_1.z.object({ module: zod_1.z.literal('speed'), action: zod_1.z.literal('configure'), params: hardware_1.speedConfigurationSchema }),
21
+ zod_1.z.object({
22
+ module: zod_1.z.literal('speed'),
23
+ action: zod_1.z.literal('configure'),
24
+ params: exports.configureSpeedActionCommandOptionsSchema,
25
+ }),
18
26
  ]);
19
27
  // --- Sound Commands ---
20
28
  exports.playSoundActionCommandOptionsSchema = hardware_1.playSoundOptionsSchema.omit({ durationMs: true }).extend({
@@ -244,6 +244,10 @@ export declare const flowSchema: z.ZodObject<{
244
244
  }>;
245
245
  brightness: z.ZodNumber;
246
246
  effectTime: z.ZodNumber;
247
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
248
+ readonly FRONT: "front";
249
+ readonly BACK: "back";
250
+ }>>>;
247
251
  }, z.core.$strip>;
248
252
  }, z.core.$strip>, z.ZodObject<{
249
253
  module: z.ZodLiteral<"rgb">;
@@ -269,6 +273,10 @@ export declare const flowSchema: z.ZodObject<{
269
273
  readonly EMERGENCY_EFFECT: "Emergency Effect";
270
274
  readonly WAIT_EFFECT: "Wait Effect";
271
275
  }>;
276
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
277
+ readonly FRONT: "front";
278
+ readonly BACK: "back";
279
+ }>>>;
272
280
  }, z.core.$strip>;
273
281
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
274
282
  module: z.ZodLiteral<"speed">;
@@ -287,8 +295,8 @@ export declare const flowSchema: z.ZodObject<{
287
295
  module: z.ZodLiteral<"speed">;
288
296
  action: z.ZodLiteral<"configure">;
289
297
  params: z.ZodObject<{
290
- defaultSpeed: z.ZodNumber;
291
- timeDuration: z.ZodNumber;
298
+ defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
299
+ timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
292
300
  }, z.core.$strip>;
293
301
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
294
302
  module: z.ZodLiteral<"leftStarBackLaser">;
@@ -69,7 +69,7 @@ export declare const gameSchema: z.ZodObject<{
69
69
  position: z.ZodNumber;
70
70
  time: z.ZodNumber;
71
71
  }, z.core.$strip>>;
72
- tutorialConfigId: z.ZodOptional<z.ZodString>;
72
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
73
  }, z.core.$strip>;
74
74
  export declare const assignKartSchema: z.ZodObject<{
75
75
  playerId: z.ZodString;
@@ -34,7 +34,7 @@ exports.gameSchema = zod_1.z.object({
34
34
  finishedReason: exports.gameFinishedReasonSchema.optional(),
35
35
  kartsState: zod_1.z.record(zod_1.z.string(), exports.gameKartStateSchema),
36
36
  gameRanking: zod_1.z.array(exports.kartRankingItemSchema),
37
- tutorialConfigId: zod_1.z.string().optional(),
37
+ tutorialConfigId: zod_1.z.string().nullable().optional(),
38
38
  });
39
39
  exports.assignKartSchema = zod_1.z.object({
40
40
  playerId: zod_1.z.string(),
@@ -36,7 +36,7 @@ export declare const battleSchema: z.ZodObject<{
36
36
  position: z.ZodNumber;
37
37
  time: z.ZodNumber;
38
38
  }, z.core.$strip>>;
39
- tutorialConfigId: z.ZodOptional<z.ZodString>;
39
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
40
  type: z.ZodLiteral<"Battle">;
41
41
  lives: z.ZodNumber;
42
42
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -57,5 +57,4 @@ export declare const createBattleSchema: z.ZodObject<{
57
57
  gameTrackId: z.ZodString;
58
58
  gameTurnId: z.ZodOptional<z.ZodString>;
59
59
  isOfficial: z.ZodOptional<z.ZodBoolean>;
60
- tutorialConfigId: z.ZodOptional<z.ZodString>;
61
60
  }, z.core.$strip>;
@@ -27,5 +27,4 @@ exports.createBattleSchema = zod_1.z.object({
27
27
  gameTrackId: zod_1.z.string(),
28
28
  gameTurnId: zod_1.z.string().optional(),
29
29
  isOfficial: zod_1.z.boolean().optional(),
30
- tutorialConfigId: zod_1.z.string().optional(),
31
30
  });
@@ -106,7 +106,7 @@ export declare const raceSchema: z.ZodObject<{
106
106
  readonly EMERGENCY: "EMERGENCY";
107
107
  readonly BY_CONTROLLER: "BY_CONTROLLER";
108
108
  }>>;
109
- tutorialConfigId: z.ZodOptional<z.ZodString>;
109
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
110
  type: z.ZodLiteral<"Race">;
111
111
  laps: z.ZodNumber;
112
112
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -166,7 +166,7 @@ export declare const raceWithDetailedRankingSchema: z.ZodObject<{
166
166
  readonly EMERGENCY: "EMERGENCY";
167
167
  readonly BY_CONTROLLER: "BY_CONTROLLER";
168
168
  }>>;
169
- tutorialConfigId: z.ZodOptional<z.ZodString>;
169
+ tutorialConfigId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
170
  type: z.ZodLiteral<"Race">;
171
171
  laps: z.ZodNumber;
172
172
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -235,5 +235,4 @@ export declare const createRaceSchema: z.ZodObject<{
235
235
  gameTrackId: z.ZodString;
236
236
  gameTurnId: z.ZodOptional<z.ZodString>;
237
237
  isOfficial: z.ZodOptional<z.ZodBoolean>;
238
- tutorialConfigId: z.ZodOptional<z.ZodString>;
239
238
  }, z.core.$strip>;
@@ -70,5 +70,4 @@ exports.createRaceSchema = exports.startRaceSchema.partial().extend({
70
70
  gameTrackId: zod_1.z.string(),
71
71
  gameTurnId: zod_1.z.string().optional(),
72
72
  isOfficial: zod_1.z.boolean().optional(),
73
- tutorialConfigId: zod_1.z.string().optional(),
74
73
  });
@@ -17,6 +17,8 @@ export declare const gameTrackKartsConfigSchema: z.ZodObject<{
17
17
  waitTimeAfterHit: z.ZodNumber;
18
18
  }, z.core.$strip>;
19
19
  lowSpeed: z.ZodNumber;
20
+ tutorialSpeed: z.ZodNumber;
21
+ tutorialReturnSpeed: z.ZodNumber;
20
22
  }, z.core.$strip>;
21
23
  export declare const gameTrackKartConfigSchema: z.ZodObject<{
22
24
  gameTrackId: z.ZodString;
@@ -72,6 +74,8 @@ export declare const gameTrackSchema: z.ZodObject<{
72
74
  waitTimeAfterHit: z.ZodNumber;
73
75
  }, z.core.$strip>;
74
76
  lowSpeed: z.ZodNumber;
77
+ tutorialSpeed: z.ZodNumber;
78
+ tutorialReturnSpeed: z.ZodNumber;
75
79
  }, z.core.$strip>;
76
80
  macAddress: z.ZodOptional<z.ZodString>;
77
81
  isConnected: z.ZodBoolean;
@@ -18,6 +18,8 @@ exports.gameTrackKartsConfigSchema = zod_1.z.object({
18
18
  diskSensorBallShooter: hardware_1.configDiskSensorBallShooterModuleOptionsSchema,
19
19
  ballSensorDiskThrower: hardware_1.configureBallSensorDiskThrowerModuleOptionsSchema,
20
20
  lowSpeed: zod_1.z.number().min(0).max(100),
21
+ tutorialSpeed: zod_1.z.number().min(0).max(100),
22
+ tutorialReturnSpeed: zod_1.z.number().min(0).max(100),
21
23
  });
22
24
  exports.gameTrackKartConfigSchema = zod_1.z.object({
23
25
  gameTrackId: zod_1.z.string(),
@@ -13,7 +13,10 @@ export declare const kartHardwareStateSchema: z.ZodObject<{
13
13
  current: z.ZodNumber;
14
14
  configured: z.ZodNumber;
15
15
  }, z.core.$strip>>;
16
- rgb: z.ZodNullable<z.ZodEnum<{
16
+ rgb: z.ZodRecord<z.ZodEnum<{
17
+ readonly FRONT: "front";
18
+ readonly BACK: "back";
19
+ }> & z.core.$partial, z.ZodEnum<{
17
20
  readonly SHOWING_COLOR: "Showing Color";
18
21
  readonly NOT_CONFIGURED: "Not Configured";
19
22
  readonly CONFIGURING_RGB: "Configuring RGB";
@@ -16,7 +16,8 @@ exports.kartHardwareStateSchema = zod_1.z.object({
16
16
  configured: zod_1.z.number(),
17
17
  })
18
18
  .nullable(),
19
- rgb: rgb_1.rgbStatusSchema.nullable(),
19
+ // Only the configured RGB modules have a key
20
+ rgb: zod_1.z.partialRecord(rgb_1.rgbModuleLabelSchema, rgb_1.rgbStatusSchema),
20
21
  flag: zod_1.z
21
22
  .object({
22
23
  status: flag_1.flagStatusSchema,