@battle-racing/br-common-lib 6.2.0-rc.9 → 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 (44) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/dist/domains/arcade/Arcade.const.d.ts +9 -0
  3. package/dist/domains/arcade/Arcade.const.js +12 -0
  4. package/dist/domains/arcade/Arcade.schema.d.ts +83 -0
  5. package/dist/domains/arcade/Arcade.schema.js +48 -0
  6. package/dist/domains/arcade/Arcade.types.d.ts +11 -0
  7. package/dist/domains/arcade/Arcade.types.js +2 -0
  8. package/dist/domains/arcade/index.d.ts +3 -0
  9. package/dist/domains/arcade/index.js +19 -0
  10. package/dist/domains/command/Command.schema.d.ts +16 -0
  11. package/dist/domains/flow/Flow.schema.d.ts +8 -0
  12. package/dist/domains/hardware/KartHardwareState.schema.d.ts +4 -1
  13. package/dist/domains/hardware/KartHardwareState.schema.js +2 -1
  14. package/dist/domains/hardware/ModuleStatus.schema.d.ts +5 -0
  15. package/dist/domains/hardware/rgb/RGB.const.d.ts +4 -0
  16. package/dist/domains/hardware/rgb/RGB.const.js +5 -1
  17. package/dist/domains/hardware/rgb/RGB.schema.d.ts +21 -0
  18. package/dist/domains/hardware/rgb/RGB.schema.js +8 -1
  19. package/dist/domains/hardware/rgb/RGB.types.d.ts +3 -1
  20. package/dist/domains/hardware/screen/ScreenDebug.schema.d.ts +4 -1
  21. package/dist/domains/kart/Kart.schema.d.ts +4 -1
  22. package/dist/domains/powerUp/PowerUp.schema.d.ts +24 -0
  23. package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.d.ts +13 -0
  24. package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.js +2 -0
  25. package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.d.ts +7 -0
  26. package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.js +10 -0
  27. package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.d.ts +9 -0
  28. package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.js +2 -0
  29. package/dist/domains/socket/utils/SocketParamsToEventsWithAck.d.ts +5 -0
  30. package/dist/domains/socket/utils/SocketParamsToEventsWithAck.js +2 -0
  31. package/dist/domains/tutorial/TutorialConfig.schema.d.ts +24 -0
  32. package/dist/domains/wallet/Wallet.const.d.ts +4 -0
  33. package/dist/domains/wallet/Wallet.const.js +7 -0
  34. package/dist/domains/wallet/Wallet.schema.d.ts +57 -0
  35. package/dist/domains/wallet/Wallet.schema.js +43 -0
  36. package/dist/domains/wallet/Wallet.types.d.ts +9 -0
  37. package/dist/domains/wallet/Wallet.types.js +2 -0
  38. package/dist/domains/wallet/index.d.ts +3 -0
  39. package/dist/domains/wallet/index.js +19 -0
  40. package/package.json +1 -1
  41. package/src/domains/hardware/KartHardwareState.schema.ts +3 -2
  42. package/src/domains/hardware/rgb/RGB.const.ts +5 -0
  43. package/src/domains/hardware/rgb/RGB.schema.ts +10 -1
  44. package/src/domains/hardware/rgb/RGB.types.ts +4 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm whoami *)",
5
+ "Bash(npm config *)"
6
+ ]
7
+ }
8
+ }
@@ -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);
@@ -336,6 +336,10 @@ export declare const rgbModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
336
336
  }>;
337
337
  brightness: z.ZodNumber;
338
338
  effectTime: z.ZodNumber;
339
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
340
+ readonly FRONT: "front";
341
+ readonly BACK: "back";
342
+ }>>>;
339
343
  }, z.core.$strip>;
340
344
  }, z.core.$strip>, z.ZodObject<{
341
345
  module: z.ZodLiteral<"rgb">;
@@ -361,6 +365,10 @@ export declare const rgbModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
361
365
  readonly EMERGENCY_EFFECT: "Emergency Effect";
362
366
  readonly WAIT_EFFECT: "Wait Effect";
363
367
  }>;
368
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
369
+ readonly FRONT: "front";
370
+ readonly BACK: "back";
371
+ }>>>;
364
372
  }, z.core.$strip>;
365
373
  }, z.core.$strip>]>;
366
374
  export declare const leftStarBackLaserModuleCommandSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -1271,6 +1279,10 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1271
1279
  }>;
1272
1280
  brightness: z.ZodNumber;
1273
1281
  effectTime: z.ZodNumber;
1282
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1283
+ readonly FRONT: "front";
1284
+ readonly BACK: "back";
1285
+ }>>>;
1274
1286
  }, z.core.$strip>;
1275
1287
  }, z.core.$strip>, z.ZodObject<{
1276
1288
  module: z.ZodLiteral<"rgb">;
@@ -1296,6 +1308,10 @@ export declare const allCommandsConfigSchema: z.ZodIntersection<z.ZodUnion<reado
1296
1308
  readonly EMERGENCY_EFFECT: "Emergency Effect";
1297
1309
  readonly WAIT_EFFECT: "Wait Effect";
1298
1310
  }>;
1311
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1312
+ readonly FRONT: "front";
1313
+ readonly BACK: "back";
1314
+ }>>>;
1299
1315
  }, z.core.$strip>;
1300
1316
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1301
1317
  module: z.ZodLiteral<"speed">;
@@ -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">;
@@ -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,
@@ -28,6 +28,11 @@ export declare const moduleStatusSchema: z.ZodUnion<readonly [z.ZodObject<{
28
28
  DACVoltage: z.ZodNumber;
29
29
  currentDefaultSpeedConfig: z.ZodNumber;
30
30
  }, z.core.$strip>, z.ZodObject<{
31
+ label: z.ZodEnum<{
32
+ readonly FRONT: "front";
33
+ readonly BACK: "back";
34
+ }>;
35
+ address: z.ZodNumber;
31
36
  rgbStatus: z.ZodEnum<{
32
37
  readonly SHOWING_COLOR: "Showing Color";
33
38
  readonly NOT_CONFIGURED: "Not Configured";
@@ -10,3 +10,7 @@ export declare const RGB_ACTION_COMMANDS: {
10
10
  readonly EXEC: "Exec";
11
11
  readonly CONFIGURE: "Configure";
12
12
  };
13
+ export declare const RGB_MODULE_LABEL: {
14
+ readonly FRONT: "front";
15
+ readonly BACK: "back";
16
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RGB_ACTION_COMMANDS = exports.RGB_STATUS = void 0;
3
+ exports.RGB_MODULE_LABEL = exports.RGB_ACTION_COMMANDS = exports.RGB_STATUS = void 0;
4
4
  exports.RGB_STATUS = {
5
5
  SHOWING_COLOR: 'Showing Color',
6
6
  NOT_CONFIGURED: 'Not Configured',
@@ -13,3 +13,7 @@ exports.RGB_ACTION_COMMANDS = {
13
13
  EXEC: 'Exec',
14
14
  CONFIGURE: 'Configure',
15
15
  };
16
+ exports.RGB_MODULE_LABEL = {
17
+ FRONT: 'front',
18
+ BACK: 'back',
19
+ };
@@ -11,7 +11,20 @@ export declare const rgbActionCommandSchema: z.ZodEnum<{
11
11
  readonly EXEC: "Exec";
12
12
  readonly CONFIGURE: "Configure";
13
13
  }>;
14
+ export declare const rgbModuleLabelSchema: z.ZodEnum<{
15
+ readonly FRONT: "front";
16
+ readonly BACK: "back";
17
+ }>;
18
+ export declare const rgbTargetsSchema: z.ZodOptional<z.ZodArray<z.ZodEnum<{
19
+ readonly FRONT: "front";
20
+ readonly BACK: "back";
21
+ }>>>;
14
22
  export declare const rgbModuleStatusSchema: z.ZodObject<{
23
+ label: z.ZodEnum<{
24
+ readonly FRONT: "front";
25
+ readonly BACK: "back";
26
+ }>;
27
+ address: z.ZodNumber;
15
28
  rgbStatus: z.ZodEnum<{
16
29
  readonly SHOWING_COLOR: "Showing Color";
17
30
  readonly NOT_CONFIGURED: "Not Configured";
@@ -52,6 +65,10 @@ export declare const rgbConfigurationOptionsSchema: z.ZodObject<{
52
65
  }>;
53
66
  brightness: z.ZodNumber;
54
67
  effectTime: z.ZodNumber;
68
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
69
+ readonly FRONT: "front";
70
+ readonly BACK: "back";
71
+ }>>>;
55
72
  }, z.core.$strip>;
56
73
  export declare const rgbShowEffectOptionsSchema: z.ZodObject<{
57
74
  effect: z.ZodEnum<{
@@ -74,4 +91,8 @@ export declare const rgbShowEffectOptionsSchema: z.ZodObject<{
74
91
  readonly EMERGENCY_EFFECT: "Emergency Effect";
75
92
  readonly WAIT_EFFECT: "Wait Effect";
76
93
  }>;
94
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
95
+ readonly FRONT: "front";
96
+ readonly BACK: "back";
97
+ }>>>;
77
98
  }, z.core.$strip>;
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rgbShowEffectOptionsSchema = exports.rgbConfigurationOptionsSchema = exports.rgbModuleStatusSchema = exports.rgbActionCommandSchema = exports.rgbStatusSchema = void 0;
3
+ exports.rgbShowEffectOptionsSchema = exports.rgbConfigurationOptionsSchema = exports.rgbModuleStatusSchema = exports.rgbTargetsSchema = exports.rgbModuleLabelSchema = exports.rgbActionCommandSchema = exports.rgbStatusSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const color_1 = require("../../color");
6
6
  const kart_effect_1 = require("../../hardware/kart-effect");
7
7
  const RGB_const_1 = require("./RGB.const");
8
8
  exports.rgbStatusSchema = zod_1.z.enum(RGB_const_1.RGB_STATUS);
9
9
  exports.rgbActionCommandSchema = zod_1.z.enum(RGB_const_1.RGB_ACTION_COMMANDS);
10
+ exports.rgbModuleLabelSchema = zod_1.z.enum(RGB_const_1.RGB_MODULE_LABEL);
11
+ // When targets is missing the command goes to every configured RGB module
12
+ exports.rgbTargetsSchema = zod_1.z.array(exports.rgbModuleLabelSchema).min(1).optional();
10
13
  exports.rgbModuleStatusSchema = zod_1.z.object({
14
+ label: exports.rgbModuleLabelSchema,
15
+ address: zod_1.z.number(),
11
16
  rgbStatus: exports.rgbStatusSchema,
12
17
  kartColor: color_1.colorNameSchema,
13
18
  });
@@ -15,7 +20,9 @@ exports.rgbConfigurationOptionsSchema = zod_1.z.object({
15
20
  kartColor: color_1.colorNameSchema,
16
21
  brightness: zod_1.z.number().min(0).max(100),
17
22
  effectTime: zod_1.z.number().min(1).max(25),
23
+ targets: exports.rgbTargetsSchema,
18
24
  });
19
25
  exports.rgbShowEffectOptionsSchema = zod_1.z.object({
20
26
  effect: kart_effect_1.kartEffectSchema,
27
+ targets: exports.rgbTargetsSchema,
21
28
  });
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { rgbActionCommandSchema, rgbConfigurationOptionsSchema, rgbModuleStatusSchema, rgbShowEffectOptionsSchema, rgbStatusSchema } from './RGB.schema';
2
+ import { rgbActionCommandSchema, rgbConfigurationOptionsSchema, rgbModuleLabelSchema, rgbModuleStatusSchema, rgbShowEffectOptionsSchema, rgbStatusSchema, rgbTargetsSchema } from './RGB.schema';
3
3
  export type RGBStatus = z.infer<typeof rgbStatusSchema>;
4
4
  export type RGBModuleStatus = z.infer<typeof rgbModuleStatusSchema>;
5
5
  export type RGBConfigurationOptions = z.infer<typeof rgbConfigurationOptionsSchema>;
6
6
  export type RGBShowEffectOptions = z.infer<typeof rgbShowEffectOptionsSchema>;
7
7
  export type RGBActionCommand = z.infer<typeof rgbActionCommandSchema>;
8
+ export type RGBModuleLabel = z.infer<typeof rgbModuleLabelSchema>;
9
+ export type RGBTargets = z.infer<typeof rgbTargetsSchema>;
@@ -13,7 +13,10 @@ export declare const screenDebugViewInputSchema: 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";
@@ -79,7 +79,10 @@ export declare const kartSchema: z.ZodObject<{
79
79
  current: z.ZodNumber;
80
80
  configured: z.ZodNumber;
81
81
  }, z.core.$strip>>;
82
- rgb: z.ZodNullable<z.ZodEnum<{
82
+ rgb: z.ZodRecord<z.ZodEnum<{
83
+ readonly FRONT: "front";
84
+ readonly BACK: "back";
85
+ }> & z.core.$partial, z.ZodEnum<{
83
86
  readonly SHOWING_COLOR: "Showing Color";
84
87
  readonly NOT_CONFIGURED: "Not Configured";
85
88
  readonly CONFIGURING_RGB: "Configuring RGB";
@@ -240,6 +240,10 @@ export declare const powerUpCommandSchema: z.ZodIntersection<z.ZodUnion<readonly
240
240
  }>;
241
241
  brightness: z.ZodNumber;
242
242
  effectTime: z.ZodNumber;
243
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
244
+ readonly FRONT: "front";
245
+ readonly BACK: "back";
246
+ }>>>;
243
247
  }, z.core.$strip>;
244
248
  }, z.core.$strip>, z.ZodObject<{
245
249
  module: z.ZodLiteral<"rgb">;
@@ -265,6 +269,10 @@ export declare const powerUpCommandSchema: z.ZodIntersection<z.ZodUnion<readonly
265
269
  readonly EMERGENCY_EFFECT: "Emergency Effect";
266
270
  readonly WAIT_EFFECT: "Wait Effect";
267
271
  }>;
272
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
273
+ readonly FRONT: "front";
274
+ readonly BACK: "back";
275
+ }>>>;
268
276
  }, z.core.$strip>;
269
277
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
270
278
  module: z.ZodLiteral<"speed">;
@@ -1244,6 +1252,10 @@ export declare const powerUpSchema: z.ZodObject<{
1244
1252
  }>;
1245
1253
  brightness: z.ZodNumber;
1246
1254
  effectTime: z.ZodNumber;
1255
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1256
+ readonly FRONT: "front";
1257
+ readonly BACK: "back";
1258
+ }>>>;
1247
1259
  }, z.core.$strip>;
1248
1260
  }, z.core.$strip>, z.ZodObject<{
1249
1261
  module: z.ZodLiteral<"rgb">;
@@ -1269,6 +1281,10 @@ export declare const powerUpSchema: z.ZodObject<{
1269
1281
  readonly EMERGENCY_EFFECT: "Emergency Effect";
1270
1282
  readonly WAIT_EFFECT: "Wait Effect";
1271
1283
  }>;
1284
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1285
+ readonly FRONT: "front";
1286
+ readonly BACK: "back";
1287
+ }>>>;
1272
1288
  }, z.core.$strip>;
1273
1289
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1274
1290
  module: z.ZodLiteral<"speed">;
@@ -2228,6 +2244,10 @@ export declare const powerUpSchema: z.ZodObject<{
2228
2244
  }>;
2229
2245
  brightness: z.ZodNumber;
2230
2246
  effectTime: z.ZodNumber;
2247
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2248
+ readonly FRONT: "front";
2249
+ readonly BACK: "back";
2250
+ }>>>;
2231
2251
  }, z.core.$strip>;
2232
2252
  }, z.core.$strip>, z.ZodObject<{
2233
2253
  module: z.ZodLiteral<"rgb">;
@@ -2253,6 +2273,10 @@ export declare const powerUpSchema: z.ZodObject<{
2253
2273
  readonly EMERGENCY_EFFECT: "Emergency Effect";
2254
2274
  readonly WAIT_EFFECT: "Wait Effect";
2255
2275
  }>;
2276
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2277
+ readonly FRONT: "front";
2278
+ readonly BACK: "back";
2279
+ }>>>;
2256
2280
  }, z.core.$strip>;
2257
2281
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
2258
2282
  module: z.ZodLiteral<"speed">;
@@ -0,0 +1,13 @@
1
+ import type { ArcadeSession, FinishArcadeSessionInput } from '../../arcade';
2
+ import type { Response } from '../../response';
3
+ import type { ArcadeSessionStartedPayload } from '../serverToClient';
4
+ export interface SocketArcadeMachineClientToServerEventsParams {
5
+ 'arcade-machine:session:start-anonymous': undefined;
6
+ 'arcade-machine:session:finish': FinishArcadeSessionInput;
7
+ }
8
+ export interface SocketArcadeMachineClientToServerAckResponses {
9
+ 'arcade-machine:session:start-anonymous': Response<ArcadeSessionStartedPayload>;
10
+ 'arcade-machine:session:finish': Response<{
11
+ session: ArcadeSession;
12
+ }>;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ /** Sent by the arcade machine in the socket.io handshake `auth` field */
3
+ export declare const socketArcadeMachineAuthInputSchema: z.ZodObject<{
4
+ machineId: z.ZodString;
5
+ secret: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export type SocketArcadeMachineAuthInput = z.infer<typeof socketArcadeMachineAuthInputSchema>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.socketArcadeMachineAuthInputSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const arcade_1 = require("../../arcade");
6
+ /** Sent by the arcade machine in the socket.io handshake `auth` field */
7
+ exports.socketArcadeMachineAuthInputSchema = zod_1.z.object({
8
+ machineId: arcade_1.arcadeMachineIdSchema,
9
+ secret: zod_1.z.string().min(1),
10
+ });
@@ -0,0 +1,9 @@
1
+ import type { ArcadeSession } from '../../arcade';
2
+ export type ArcadeSessionStartedPayload = {
3
+ session: ArcadeSession;
4
+ playerName?: string;
5
+ };
6
+ export interface SocketArcadeMachineServerToClientEventsParams {
7
+ /** A session was opened for this machine (e.g. a user scanned the machine QR) */
8
+ 'arcade-machine:session:started': ArcadeSessionStartedPayload;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export type SocketAck<Response> = (response: Response) => void;
2
+ /** Like SocketParamsToEvents, but every event receives an ack callback as last argument */
3
+ export type SocketParamsToEventsWithAck<Event, Ack extends Record<keyof Event, unknown>> = {
4
+ [EventKey in keyof Event]: Event[EventKey] extends undefined ? (ack: SocketAck<Ack[EventKey]>) => void : (payload: Event[EventKey], ack: SocketAck<Ack[EventKey]>) => void;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -324,6 +324,10 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
324
324
  }>;
325
325
  brightness: z.ZodNumber;
326
326
  effectTime: z.ZodNumber;
327
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
328
+ readonly FRONT: "front";
329
+ readonly BACK: "back";
330
+ }>>>;
327
331
  }, z.core.$strip>;
328
332
  }, z.core.$strip>, z.ZodObject<{
329
333
  module: z.ZodLiteral<"rgb">;
@@ -349,6 +353,10 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
349
353
  readonly EMERGENCY_EFFECT: "Emergency Effect";
350
354
  readonly WAIT_EFFECT: "Wait Effect";
351
355
  }>;
356
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
357
+ readonly FRONT: "front";
358
+ readonly BACK: "back";
359
+ }>>>;
352
360
  }, z.core.$strip>;
353
361
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
354
362
  module: z.ZodLiteral<"speed">;
@@ -1363,6 +1371,10 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
1363
1371
  }>;
1364
1372
  brightness: z.ZodNumber;
1365
1373
  effectTime: z.ZodNumber;
1374
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1375
+ readonly FRONT: "front";
1376
+ readonly BACK: "back";
1377
+ }>>>;
1366
1378
  }, z.core.$strip>;
1367
1379
  }, z.core.$strip>, z.ZodObject<{
1368
1380
  module: z.ZodLiteral<"rgb">;
@@ -1388,6 +1400,10 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
1388
1400
  readonly EMERGENCY_EFFECT: "Emergency Effect";
1389
1401
  readonly WAIT_EFFECT: "Wait Effect";
1390
1402
  }>;
1403
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1404
+ readonly FRONT: "front";
1405
+ readonly BACK: "back";
1406
+ }>>>;
1391
1407
  }, z.core.$strip>;
1392
1408
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
1393
1409
  module: z.ZodLiteral<"speed">;
@@ -2406,6 +2422,10 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
2406
2422
  }>;
2407
2423
  brightness: z.ZodNumber;
2408
2424
  effectTime: z.ZodNumber;
2425
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2426
+ readonly FRONT: "front";
2427
+ readonly BACK: "back";
2428
+ }>>>;
2409
2429
  }, z.core.$strip>;
2410
2430
  }, z.core.$strip>, z.ZodObject<{
2411
2431
  module: z.ZodLiteral<"rgb">;
@@ -2431,6 +2451,10 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
2431
2451
  readonly EMERGENCY_EFFECT: "Emergency Effect";
2432
2452
  readonly WAIT_EFFECT: "Wait Effect";
2433
2453
  }>;
2454
+ targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2455
+ readonly FRONT: "front";
2456
+ readonly BACK: "back";
2457
+ }>>>;
2434
2458
  }, z.core.$strip>;
2435
2459
  }, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
2436
2460
  module: z.ZodLiteral<"speed">;
@@ -0,0 +1,4 @@
1
+ export declare const WALLET_TRANSACTION_TYPE: {
2
+ readonly ADMIN_ADJUSTMENT: "ADMIN_ADJUSTMENT";
3
+ readonly ARCADE_SESSION: "ARCADE_SESSION";
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WALLET_TRANSACTION_TYPE = void 0;
4
+ exports.WALLET_TRANSACTION_TYPE = {
5
+ ADMIN_ADJUSTMENT: 'ADMIN_ADJUSTMENT',
6
+ ARCADE_SESSION: 'ARCADE_SESSION',
7
+ };
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export declare const walletTransactionTypeSchema: z.ZodEnum<{
3
+ readonly ADMIN_ADJUSTMENT: "ADMIN_ADJUSTMENT";
4
+ readonly ARCADE_SESSION: "ARCADE_SESSION";
5
+ }>;
6
+ export declare const coinsAmountSchema: z.ZodNumber;
7
+ export declare const walletSchema: z.ZodObject<{
8
+ userId: z.ZodUUID;
9
+ balance: z.ZodNumber;
10
+ updatedAt: z.ZodDate;
11
+ }, z.core.$strip>;
12
+ export declare const adminAdjustmentTransactionSchema: z.ZodObject<{
13
+ id: z.ZodUUID;
14
+ userId: z.ZodUUID;
15
+ amount: z.ZodNumber;
16
+ balanceAfter: z.ZodNumber;
17
+ createdAt: z.ZodDate;
18
+ type: z.ZodLiteral<"ADMIN_ADJUSTMENT">;
19
+ adminUserId: z.ZodUUID;
20
+ reason: z.ZodString;
21
+ }, z.core.$strip>;
22
+ export declare const arcadeSessionTransactionSchema: z.ZodObject<{
23
+ id: z.ZodUUID;
24
+ userId: z.ZodUUID;
25
+ amount: z.ZodNumber;
26
+ balanceAfter: z.ZodNumber;
27
+ createdAt: z.ZodDate;
28
+ type: z.ZodLiteral<"ARCADE_SESSION">;
29
+ arcadeSessionId: z.ZodUUID;
30
+ }, z.core.$strip>;
31
+ export declare const walletTransactionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
32
+ id: z.ZodUUID;
33
+ userId: z.ZodUUID;
34
+ amount: z.ZodNumber;
35
+ balanceAfter: z.ZodNumber;
36
+ createdAt: z.ZodDate;
37
+ type: z.ZodLiteral<"ADMIN_ADJUSTMENT">;
38
+ adminUserId: z.ZodUUID;
39
+ reason: z.ZodString;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ id: z.ZodUUID;
42
+ userId: z.ZodUUID;
43
+ amount: z.ZodNumber;
44
+ balanceAfter: z.ZodNumber;
45
+ createdAt: z.ZodDate;
46
+ type: z.ZodLiteral<"ARCADE_SESSION">;
47
+ arcadeSessionId: z.ZodUUID;
48
+ }, z.core.$strip>], "type">;
49
+ export declare const walletTransactionsFilterSchema: z.ZodObject<{
50
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
51
+ cursor: z.ZodOptional<z.ZodISODateTime>;
52
+ }, z.core.$strip>;
53
+ export declare const walletAdjustmentInputSchema: z.ZodObject<{
54
+ userId: z.ZodUUID;
55
+ amount: z.ZodNumber;
56
+ reason: z.ZodString;
57
+ }, z.core.$strip>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.walletAdjustmentInputSchema = exports.walletTransactionsFilterSchema = exports.walletTransactionSchema = exports.arcadeSessionTransactionSchema = exports.adminAdjustmentTransactionSchema = exports.walletSchema = exports.coinsAmountSchema = exports.walletTransactionTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const Wallet_const_1 = require("./Wallet.const");
6
+ exports.walletTransactionTypeSchema = zod_1.z.enum(Wallet_const_1.WALLET_TRANSACTION_TYPE);
7
+ exports.coinsAmountSchema = zod_1.z.number().int();
8
+ exports.walletSchema = zod_1.z.object({
9
+ userId: zod_1.z.uuidv4(),
10
+ balance: exports.coinsAmountSchema.nonnegative(),
11
+ updatedAt: zod_1.z.date(),
12
+ });
13
+ const baseWalletTransactionSchema = zod_1.z.object({
14
+ id: zod_1.z.uuidv4(),
15
+ userId: zod_1.z.uuidv4(),
16
+ /** Positive adds coins, negative removes coins */
17
+ amount: exports.coinsAmountSchema,
18
+ balanceAfter: exports.coinsAmountSchema.nonnegative(),
19
+ createdAt: zod_1.z.date(),
20
+ });
21
+ exports.adminAdjustmentTransactionSchema = baseWalletTransactionSchema.extend({
22
+ type: zod_1.z.literal(Wallet_const_1.WALLET_TRANSACTION_TYPE.ADMIN_ADJUSTMENT),
23
+ adminUserId: zod_1.z.uuidv4(),
24
+ reason: zod_1.z.string().min(1),
25
+ });
26
+ exports.arcadeSessionTransactionSchema = baseWalletTransactionSchema.extend({
27
+ type: zod_1.z.literal(Wallet_const_1.WALLET_TRANSACTION_TYPE.ARCADE_SESSION),
28
+ arcadeSessionId: zod_1.z.uuidv4(),
29
+ });
30
+ exports.walletTransactionSchema = zod_1.z.discriminatedUnion('type', [
31
+ exports.adminAdjustmentTransactionSchema,
32
+ exports.arcadeSessionTransactionSchema,
33
+ ]);
34
+ exports.walletTransactionsFilterSchema = zod_1.z.object({
35
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(20),
36
+ /** `createdAt` of the last item from the previous page */
37
+ cursor: zod_1.z.iso.datetime().optional(),
38
+ });
39
+ exports.walletAdjustmentInputSchema = zod_1.z.object({
40
+ userId: zod_1.z.uuidv4(),
41
+ amount: exports.coinsAmountSchema.refine((value) => value !== 0, { message: 'Amount must not be zero' }),
42
+ reason: zod_1.z.string().min(1, 'Reason is required'),
43
+ });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { adminAdjustmentTransactionSchema, arcadeSessionTransactionSchema, walletAdjustmentInputSchema, walletSchema, walletTransactionSchema, walletTransactionTypeSchema, walletTransactionsFilterSchema } from './Wallet.schema';
3
+ export type WalletTransactionType = z.infer<typeof walletTransactionTypeSchema>;
4
+ export type Wallet = z.infer<typeof walletSchema>;
5
+ export type AdminAdjustmentTransaction = z.infer<typeof adminAdjustmentTransactionSchema>;
6
+ export type ArcadeSessionTransaction = z.infer<typeof arcadeSessionTransactionSchema>;
7
+ export type WalletTransaction = z.infer<typeof walletTransactionSchema>;
8
+ export type WalletAdjustmentInput = z.infer<typeof walletAdjustmentInputSchema>;
9
+ export type WalletTransactionsFilter = z.infer<typeof walletTransactionsFilterSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './Wallet.const';
2
+ export * from './Wallet.schema';
3
+ export * from './Wallet.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("./Wallet.const"), exports);
18
+ __exportStar(require("./Wallet.schema"), exports);
19
+ __exportStar(require("./Wallet.types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "6.2.0-rc.9",
3
+ "version": "6.2.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  import { checkpointTypeSchema } from '../checkpoint/Checkpoint.schema';
2
2
  import { flagStatusSchema } from './flag';
3
- import { rgbStatusSchema } from './rgb';
3
+ import { rgbModuleLabelSchema, rgbStatusSchema } from './rgb';
4
4
  import { steeringWheelModuleStatusSchema } from './steering-wheel';
5
5
  import { screenStatusSchema } from './screen';
6
6
  import { speedStatusSchema } from './speed';
@@ -14,7 +14,8 @@ export const kartHardwareStateSchema = z.object({
14
14
  configured: z.number(),
15
15
  })
16
16
  .nullable(),
17
- rgb: rgbStatusSchema.nullable(),
17
+ // Only the configured RGB modules have a key
18
+ rgb: z.partialRecord(rgbModuleLabelSchema, rgbStatusSchema),
18
19
  flag: z
19
20
  .object({
20
21
  status: flagStatusSchema,
@@ -11,3 +11,8 @@ export const RGB_ACTION_COMMANDS = {
11
11
  EXEC: 'Exec',
12
12
  CONFIGURE: 'Configure',
13
13
  } as const;
14
+
15
+ export const RGB_MODULE_LABEL = {
16
+ FRONT: 'front',
17
+ BACK: 'back',
18
+ } as const;
@@ -1,13 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { colorNameSchema } from '../../color';
3
3
  import { kartEffectSchema } from '../../hardware/kart-effect';
4
- import { RGB_STATUS, RGB_ACTION_COMMANDS } from './RGB.const';
4
+ import { RGB_STATUS, RGB_ACTION_COMMANDS, RGB_MODULE_LABEL } from './RGB.const';
5
5
 
6
6
  export const rgbStatusSchema = z.enum(RGB_STATUS);
7
7
 
8
8
  export const rgbActionCommandSchema = z.enum(RGB_ACTION_COMMANDS);
9
9
 
10
+ export const rgbModuleLabelSchema = z.enum(RGB_MODULE_LABEL);
11
+
12
+ // When targets is missing the command goes to every configured RGB module
13
+ export const rgbTargetsSchema = z.array(rgbModuleLabelSchema).min(1).optional();
14
+
10
15
  export const rgbModuleStatusSchema = z.object({
16
+ label: rgbModuleLabelSchema,
17
+ address: z.number(),
11
18
  rgbStatus: rgbStatusSchema,
12
19
  kartColor: colorNameSchema,
13
20
  });
@@ -16,8 +23,10 @@ export const rgbConfigurationOptionsSchema = z.object({
16
23
  kartColor: colorNameSchema,
17
24
  brightness: z.number().min(0).max(100),
18
25
  effectTime: z.number().min(1).max(25),
26
+ targets: rgbTargetsSchema,
19
27
  });
20
28
 
21
29
  export const rgbShowEffectOptionsSchema = z.object({
22
30
  effect: kartEffectSchema,
31
+ targets: rgbTargetsSchema,
23
32
  });
@@ -2,9 +2,11 @@ import { z } from 'zod';
2
2
  import {
3
3
  rgbActionCommandSchema,
4
4
  rgbConfigurationOptionsSchema,
5
+ rgbModuleLabelSchema,
5
6
  rgbModuleStatusSchema,
6
7
  rgbShowEffectOptionsSchema,
7
8
  rgbStatusSchema,
9
+ rgbTargetsSchema,
8
10
  } from './RGB.schema';
9
11
 
10
12
  export type RGBStatus = z.infer<typeof rgbStatusSchema>;
@@ -12,3 +14,5 @@ export type RGBModuleStatus = z.infer<typeof rgbModuleStatusSchema>;
12
14
  export type RGBConfigurationOptions = z.infer<typeof rgbConfigurationOptionsSchema>;
13
15
  export type RGBShowEffectOptions = z.infer<typeof rgbShowEffectOptionsSchema>;
14
16
  export type RGBActionCommand = z.infer<typeof rgbActionCommandSchema>;
17
+ export type RGBModuleLabel = z.infer<typeof rgbModuleLabelSchema>;
18
+ export type RGBTargets = z.infer<typeof rgbTargetsSchema>;