@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.
- package/.claude/settings.local.json +8 -0
- package/dist/data/all-tutorial-steps.js +37 -0
- package/dist/domains/arcade/Arcade.const.d.ts +9 -0
- package/dist/domains/arcade/Arcade.const.js +12 -0
- package/dist/domains/arcade/Arcade.schema.d.ts +83 -0
- package/dist/domains/arcade/Arcade.schema.js +48 -0
- package/dist/domains/arcade/Arcade.types.d.ts +11 -0
- package/dist/domains/arcade/Arcade.types.js +2 -0
- package/dist/domains/arcade/index.d.ts +3 -0
- package/dist/domains/arcade/index.js +19 -0
- package/dist/domains/command/Command.schema.d.ts +24 -4
- package/dist/domains/command/Command.schema.js +10 -2
- package/dist/domains/flow/Flow.schema.d.ts +10 -2
- package/dist/domains/game/Game.schema.d.ts +1 -1
- package/dist/domains/game/Game.schema.js +1 -1
- package/dist/domains/game/battle/Battle.schema.d.ts +1 -2
- package/dist/domains/game/battle/Battle.schema.js +0 -1
- package/dist/domains/game/race/Race.schema.d.ts +2 -3
- package/dist/domains/game/race/Race.schema.js +0 -1
- package/dist/domains/gameTrack/GameTrack.schema.d.ts +4 -0
- package/dist/domains/gameTrack/GameTrack.schema.js +2 -0
- package/dist/domains/hardware/KartHardwareState.schema.d.ts +4 -1
- package/dist/domains/hardware/KartHardwareState.schema.js +2 -1
- package/dist/domains/hardware/ModuleStatus.schema.d.ts +5 -0
- package/dist/domains/hardware/rgb/RGB.const.d.ts +4 -0
- package/dist/domains/hardware/rgb/RGB.const.js +5 -1
- package/dist/domains/hardware/rgb/RGB.schema.d.ts +21 -0
- package/dist/domains/hardware/rgb/RGB.schema.js +8 -1
- package/dist/domains/hardware/rgb/RGB.types.d.ts +3 -1
- package/dist/domains/hardware/screen/ScreenDebug.schema.d.ts +4 -1
- package/dist/domains/kart/Kart.schema.d.ts +4 -1
- package/dist/domains/powerUp/PowerUp.schema.d.ts +30 -6
- package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.d.ts +13 -0
- package/dist/domains/socket/clientToServer/SocketArcadeMachineClientToServerEventsParams.js +2 -0
- package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.d.ts +7 -0
- package/dist/domains/socket/inputs/SocketArcadeMachineAuthInput.js +10 -0
- package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.d.ts +9 -0
- package/dist/domains/socket/serverToClient/SocketArcadeMachineServerToClientEventsParams.js +2 -0
- package/dist/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.d.ts +4 -0
- package/dist/domains/socket/utils/SocketParamsToEventsWithAck.d.ts +5 -0
- package/dist/domains/socket/utils/SocketParamsToEventsWithAck.js +2 -0
- package/dist/domains/tutorial/Tutorial.const.d.ts +0 -2
- package/dist/domains/tutorial/Tutorial.const.js +1 -16
- package/dist/domains/tutorial/Tutorial.schema.d.ts +45 -31
- package/dist/domains/tutorial/Tutorial.schema.js +21 -23
- package/dist/domains/tutorial/Tutorial.types.d.ts +4 -2
- package/dist/domains/tutorial/TutorialConfig.schema.d.ts +33 -6
- package/dist/domains/tutorial/TutorialConfig.schema.js +1 -0
- package/dist/domains/utils/Utils.schema.d.ts +2 -0
- package/dist/domains/utils/Utils.schema.js +8 -3
- package/dist/domains/wallet/Wallet.const.d.ts +4 -0
- package/dist/domains/wallet/Wallet.const.js +7 -0
- package/dist/domains/wallet/Wallet.schema.d.ts +57 -0
- package/dist/domains/wallet/Wallet.schema.js +43 -0
- package/dist/domains/wallet/Wallet.types.d.ts +9 -0
- package/dist/domains/wallet/Wallet.types.js +2 -0
- package/dist/domains/wallet/index.d.ts +3 -0
- package/dist/domains/wallet/index.js +19 -0
- package/package.json +1 -1
- package/src/data/all-tutorial-steps.ts +41 -0
- package/src/domains/command/Command.schema.ts +10 -2
- package/src/domains/game/Game.schema.ts +1 -1
- package/src/domains/game/battle/Battle.schema.ts +0 -1
- package/src/domains/game/race/Race.schema.ts +0 -1
- package/src/domains/gameTrack/GameTrack.schema.ts +2 -0
- package/src/domains/hardware/KartHardwareState.schema.ts +3 -2
- package/src/domains/hardware/rgb/RGB.const.ts +5 -0
- package/src/domains/hardware/rgb/RGB.schema.ts +10 -1
- package/src/domains/hardware/rgb/RGB.types.ts +4 -0
- package/src/domains/socket/serverToClient/SocketWebAppServerToClientEventsParams.ts +2 -0
- package/src/domains/tutorial/Tutorial.const.ts +0 -16
- package/src/domains/tutorial/Tutorial.schema.ts +22 -22
- package/src/domains/tutorial/Tutorial.types.ts +6 -3
- package/src/domains/tutorial/TutorialConfig.schema.ts +1 -0
- package/src/domains/utils/Utils.schema.ts +8 -3
|
@@ -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">;
|
|
@@ -367,8 +375,8 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
|
|
|
367
375
|
module: z.ZodLiteral<"speed">;
|
|
368
376
|
action: z.ZodLiteral<"configure">;
|
|
369
377
|
params: z.ZodObject<{
|
|
370
|
-
defaultSpeed: z.ZodNumber
|
|
371
|
-
timeDuration: z.ZodNumber
|
|
378
|
+
defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
379
|
+
timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
372
380
|
}, z.core.$strip>;
|
|
373
381
|
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
374
382
|
module: z.ZodLiteral<"leftStarBackLaser">;
|
|
@@ -1067,6 +1075,7 @@ export declare const tutorialStepConfigSchema: z.ZodObject<{
|
|
|
1067
1075
|
}, z.core.$strip>]>]>, z.ZodObject<{
|
|
1068
1076
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
1069
1077
|
}, z.core.$strip>>>;
|
|
1078
|
+
executePowerUpId: z.ZodOptional<z.ZodString>;
|
|
1070
1079
|
}, z.core.$strip>;
|
|
1071
1080
|
export declare const tutorialPhaseConfigSchema: z.ZodObject<{
|
|
1072
1081
|
id: z.ZodEnum<{
|
|
@@ -1362,6 +1371,10 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
|
|
|
1362
1371
|
}>;
|
|
1363
1372
|
brightness: z.ZodNumber;
|
|
1364
1373
|
effectTime: z.ZodNumber;
|
|
1374
|
+
targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1375
|
+
readonly FRONT: "front";
|
|
1376
|
+
readonly BACK: "back";
|
|
1377
|
+
}>>>;
|
|
1365
1378
|
}, z.core.$strip>;
|
|
1366
1379
|
}, z.core.$strip>, z.ZodObject<{
|
|
1367
1380
|
module: z.ZodLiteral<"rgb">;
|
|
@@ -1387,6 +1400,10 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
|
|
|
1387
1400
|
readonly EMERGENCY_EFFECT: "Emergency Effect";
|
|
1388
1401
|
readonly WAIT_EFFECT: "Wait Effect";
|
|
1389
1402
|
}>;
|
|
1403
|
+
targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1404
|
+
readonly FRONT: "front";
|
|
1405
|
+
readonly BACK: "back";
|
|
1406
|
+
}>>>;
|
|
1390
1407
|
}, z.core.$strip>;
|
|
1391
1408
|
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
1392
1409
|
module: z.ZodLiteral<"speed">;
|
|
@@ -1405,8 +1422,8 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
|
|
|
1405
1422
|
module: z.ZodLiteral<"speed">;
|
|
1406
1423
|
action: z.ZodLiteral<"configure">;
|
|
1407
1424
|
params: z.ZodObject<{
|
|
1408
|
-
defaultSpeed: z.ZodNumber
|
|
1409
|
-
timeDuration: z.ZodNumber
|
|
1425
|
+
defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
1426
|
+
timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
1410
1427
|
}, z.core.$strip>;
|
|
1411
1428
|
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
1412
1429
|
module: z.ZodLiteral<"leftStarBackLaser">;
|
|
@@ -2105,6 +2122,7 @@ export declare const tutorialPhaseConfigSchema: z.ZodObject<{
|
|
|
2105
2122
|
}, z.core.$strip>]>]>, z.ZodObject<{
|
|
2106
2123
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
2107
2124
|
}, z.core.$strip>>>;
|
|
2125
|
+
executePowerUpId: z.ZodOptional<z.ZodString>;
|
|
2108
2126
|
}, z.core.$strip>>;
|
|
2109
2127
|
}, z.core.$strip>;
|
|
2110
2128
|
export declare const tutorialMasterConfigSchema: z.ZodObject<{
|
|
@@ -2404,6 +2422,10 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
|
|
|
2404
2422
|
}>;
|
|
2405
2423
|
brightness: z.ZodNumber;
|
|
2406
2424
|
effectTime: z.ZodNumber;
|
|
2425
|
+
targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
2426
|
+
readonly FRONT: "front";
|
|
2427
|
+
readonly BACK: "back";
|
|
2428
|
+
}>>>;
|
|
2407
2429
|
}, z.core.$strip>;
|
|
2408
2430
|
}, z.core.$strip>, z.ZodObject<{
|
|
2409
2431
|
module: z.ZodLiteral<"rgb">;
|
|
@@ -2429,6 +2451,10 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
|
|
|
2429
2451
|
readonly EMERGENCY_EFFECT: "Emergency Effect";
|
|
2430
2452
|
readonly WAIT_EFFECT: "Wait Effect";
|
|
2431
2453
|
}>;
|
|
2454
|
+
targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
2455
|
+
readonly FRONT: "front";
|
|
2456
|
+
readonly BACK: "back";
|
|
2457
|
+
}>>>;
|
|
2432
2458
|
}, z.core.$strip>;
|
|
2433
2459
|
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
2434
2460
|
module: z.ZodLiteral<"speed">;
|
|
@@ -2447,8 +2473,8 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
|
|
|
2447
2473
|
module: z.ZodLiteral<"speed">;
|
|
2448
2474
|
action: z.ZodLiteral<"configure">;
|
|
2449
2475
|
params: z.ZodObject<{
|
|
2450
|
-
defaultSpeed: z.ZodNumber
|
|
2451
|
-
timeDuration: z.ZodNumber
|
|
2476
|
+
defaultSpeed: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
2477
|
+
timeDuration: z.ZodUnion<readonly [z.ZodNumber, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>]>;
|
|
2452
2478
|
}, z.core.$strip>;
|
|
2453
2479
|
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodObject<{
|
|
2454
2480
|
module: z.ZodLiteral<"leftStarBackLaser">;
|
|
@@ -3147,6 +3173,7 @@ export declare const tutorialMasterConfigSchema: z.ZodObject<{
|
|
|
3147
3173
|
}, z.core.$strip>]>]>, z.ZodObject<{
|
|
3148
3174
|
params: z.ZodOptional<z.ZodUnknown>;
|
|
3149
3175
|
}, z.core.$strip>>>;
|
|
3176
|
+
executePowerUpId: z.ZodOptional<z.ZodString>;
|
|
3150
3177
|
}, z.core.$strip>>;
|
|
3151
3178
|
}, z.core.$strip>>;
|
|
3152
3179
|
}, z.core.$strip>;
|
|
@@ -29,6 +29,7 @@ exports.tutorialStepConfigSchema = zod_1.z.object({
|
|
|
29
29
|
screenStep: Tutorial_schema_1.tutorialScreenStepSchema,
|
|
30
30
|
listenEvent: exports.tutorialListenEventSchema,
|
|
31
31
|
triggerCommands: zod_1.z.array(Command_schema_1.allCommandsConfigSchema),
|
|
32
|
+
executePowerUpId: zod_1.z.string().optional(),
|
|
32
33
|
});
|
|
33
34
|
exports.tutorialPhaseConfigSchema = zod_1.z.object({
|
|
34
35
|
id: Tutorial_schema_1.tutorialPhaseIdSchema,
|
|
@@ -9,6 +9,8 @@ export declare const simpleArithmeticStringSchema: z.ZodString;
|
|
|
9
9
|
export declare const kartContextVariableSchema: z.ZodEnum<{
|
|
10
10
|
"$kart.configuredSpeed": "$kart.configuredSpeed";
|
|
11
11
|
"$kart.powerUpTime": "$kart.powerUpTime";
|
|
12
|
+
"$kart.tutorialSpeed": "$kart.tutorialSpeed";
|
|
13
|
+
"$kart.tutorialReturnSpeed": "$kart.tutorialReturnSpeed";
|
|
12
14
|
}>;
|
|
13
15
|
export declare const contextArithmeticStringSchema: z.ZodString;
|
|
14
16
|
export declare const arithmeticExpressionSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>;
|
|
@@ -5,9 +5,14 @@ const zod_1 = require("zod");
|
|
|
5
5
|
exports.arithmeticOperatorSchema = zod_1.z.enum(['+', '-', '*', '/']);
|
|
6
6
|
// Regex for SimpleArithmeticString: check for operator followed by numbers
|
|
7
7
|
exports.simpleArithmeticStringSchema = zod_1.z.string().regex(/^[\+\-\*\/]-?\d+(\.\d+)?$/);
|
|
8
|
-
// Regex for ContextArithmeticString: $variable operator number
|
|
9
|
-
exports.kartContextVariableSchema = zod_1.z.enum([
|
|
10
|
-
|
|
8
|
+
// Regex for ContextArithmeticString: $variable, optionally followed by operator number
|
|
9
|
+
exports.kartContextVariableSchema = zod_1.z.enum([
|
|
10
|
+
'$kart.configuredSpeed',
|
|
11
|
+
'$kart.powerUpTime',
|
|
12
|
+
'$kart.tutorialSpeed',
|
|
13
|
+
'$kart.tutorialReturnSpeed',
|
|
14
|
+
]);
|
|
15
|
+
exports.contextArithmeticStringSchema = zod_1.z.string().regex(/^\$[a-zA-Z0-9\.]+(\s[\+\-\*\/]\s-?\d+(\.\d+)?)?$/);
|
|
11
16
|
exports.arithmeticExpressionSchema = zod_1.z.union([
|
|
12
17
|
zod_1.z.number(),
|
|
13
18
|
exports.simpleArithmeticStringSchema,
|
|
@@ -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,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,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AllCommandsConfig,
|
|
2
3
|
POWER_UP_NAME,
|
|
3
4
|
SOUND_NAME,
|
|
4
5
|
ScreenTutorialHud,
|
|
@@ -24,6 +25,26 @@ const nitroTutorialHud: ScreenTutorialHud = {
|
|
|
24
25
|
powerUp: POWER_UP_NAME.BATTLE_NITRO,
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
const startDrivingCommands: AllCommandsConfig[] = [
|
|
29
|
+
{ module: 'speed', action: 'activate' },
|
|
30
|
+
{ module: 'speed', action: 'change', params: { speed: '$kart.tutorialSpeed', forUnlimitedTime: true } },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const stopKartCommands: AllCommandsConfig[] = [
|
|
34
|
+
{ module: 'speed', action: 'change', params: { speed: 0, forUnlimitedTime: true } },
|
|
35
|
+
{ module: 'speed', action: 'deactivate' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
// The step fires the nitro, after it ends the speed module goes back to its default speed
|
|
39
|
+
const returnToFinishCommands: AllCommandsConfig[] = [
|
|
40
|
+
{
|
|
41
|
+
module: 'speed',
|
|
42
|
+
action: 'configure',
|
|
43
|
+
params: { defaultSpeed: '$kart.tutorialReturnSpeed', timeDuration: '$kart.powerUpTime' },
|
|
44
|
+
},
|
|
45
|
+
{ module: 'speed', action: 'activate' },
|
|
46
|
+
];
|
|
47
|
+
|
|
27
48
|
export const allTutorialConfig: TutorialMasterConfig = {
|
|
28
49
|
id: 'tutorial-master-v1',
|
|
29
50
|
name: 'Standard Circuit Induction Tutorial',
|
|
@@ -43,6 +64,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
43
64
|
durationMs: 5000,
|
|
44
65
|
},
|
|
45
66
|
triggerCommands: [
|
|
67
|
+
...stopKartCommands,
|
|
46
68
|
{
|
|
47
69
|
module: 'screen',
|
|
48
70
|
action: 'showTutorialView',
|
|
@@ -62,6 +84,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
62
84
|
durationMs: 6000,
|
|
63
85
|
},
|
|
64
86
|
triggerCommands: [
|
|
87
|
+
...stopKartCommands,
|
|
65
88
|
{
|
|
66
89
|
module: 'screen',
|
|
67
90
|
action: 'showTutorialView',
|
|
@@ -88,6 +111,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
88
111
|
durationMs: 4000,
|
|
89
112
|
},
|
|
90
113
|
triggerCommands: [
|
|
114
|
+
...stopKartCommands,
|
|
91
115
|
{
|
|
92
116
|
module: 'screen',
|
|
93
117
|
action: 'showTutorialView',
|
|
@@ -107,6 +131,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
107
131
|
durationMs: 5000,
|
|
108
132
|
},
|
|
109
133
|
triggerCommands: [
|
|
134
|
+
...stopKartCommands,
|
|
110
135
|
{
|
|
111
136
|
module: 'screen',
|
|
112
137
|
action: 'showTutorialView',
|
|
@@ -126,6 +151,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
126
151
|
durationMs: 6000,
|
|
127
152
|
},
|
|
128
153
|
triggerCommands: [
|
|
154
|
+
...startDrivingCommands,
|
|
129
155
|
{
|
|
130
156
|
module: 'screen',
|
|
131
157
|
action: 'showTutorialView',
|
|
@@ -152,6 +178,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
152
178
|
target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
|
|
153
179
|
},
|
|
154
180
|
triggerCommands: [
|
|
181
|
+
...startDrivingCommands,
|
|
155
182
|
{
|
|
156
183
|
module: 'screen',
|
|
157
184
|
action: 'showTutorialView',
|
|
@@ -179,6 +206,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
179
206
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.RIGHT,
|
|
180
207
|
},
|
|
181
208
|
triggerCommands: [
|
|
209
|
+
...stopKartCommands,
|
|
182
210
|
{
|
|
183
211
|
module: 'screen',
|
|
184
212
|
action: 'showTutorialView',
|
|
@@ -198,6 +226,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
198
226
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.LEFT,
|
|
199
227
|
},
|
|
200
228
|
triggerCommands: [
|
|
229
|
+
...stopKartCommands,
|
|
201
230
|
{
|
|
202
231
|
module: 'screen',
|
|
203
232
|
action: 'showTutorialView',
|
|
@@ -217,6 +246,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
217
246
|
durationMs: 4000,
|
|
218
247
|
},
|
|
219
248
|
triggerCommands: [
|
|
249
|
+
...stopKartCommands,
|
|
220
250
|
{
|
|
221
251
|
module: 'screen',
|
|
222
252
|
action: 'showTutorialView',
|
|
@@ -236,6 +266,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
236
266
|
target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
|
|
237
267
|
},
|
|
238
268
|
triggerCommands: [
|
|
269
|
+
...startDrivingCommands,
|
|
239
270
|
{
|
|
240
271
|
module: 'screen',
|
|
241
272
|
action: 'showTutorialView',
|
|
@@ -256,6 +287,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
256
287
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
257
288
|
},
|
|
258
289
|
triggerCommands: [
|
|
290
|
+
...stopKartCommands,
|
|
259
291
|
{
|
|
260
292
|
module: 'screen',
|
|
261
293
|
action: 'showTutorialView',
|
|
@@ -276,6 +308,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
276
308
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
277
309
|
},
|
|
278
310
|
triggerCommands: [
|
|
311
|
+
...stopKartCommands,
|
|
279
312
|
{
|
|
280
313
|
module: 'screen',
|
|
281
314
|
action: 'showTutorialView',
|
|
@@ -296,6 +329,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
296
329
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
297
330
|
},
|
|
298
331
|
triggerCommands: [
|
|
332
|
+
...stopKartCommands,
|
|
299
333
|
{
|
|
300
334
|
module: 'screen',
|
|
301
335
|
action: 'showTutorialView',
|
|
@@ -316,6 +350,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
316
350
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
317
351
|
},
|
|
318
352
|
triggerCommands: [
|
|
353
|
+
...stopKartCommands,
|
|
319
354
|
{
|
|
320
355
|
module: 'screen',
|
|
321
356
|
action: 'showTutorialView',
|
|
@@ -343,6 +378,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
343
378
|
target: TUTORIAL_CHECKPOINT_TARGET.POWER_UP,
|
|
344
379
|
},
|
|
345
380
|
triggerCommands: [
|
|
381
|
+
...startDrivingCommands,
|
|
346
382
|
{
|
|
347
383
|
module: 'screen',
|
|
348
384
|
action: 'showTutorialView',
|
|
@@ -363,6 +399,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
363
399
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
364
400
|
},
|
|
365
401
|
triggerCommands: [
|
|
402
|
+
...stopKartCommands,
|
|
366
403
|
{
|
|
367
404
|
module: 'screen',
|
|
368
405
|
action: 'showTutorialView',
|
|
@@ -383,6 +420,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
383
420
|
button: TUTORIAL_STEERING_WHEEL_BUTTON.ANY,
|
|
384
421
|
},
|
|
385
422
|
triggerCommands: [
|
|
423
|
+
...startDrivingCommands,
|
|
386
424
|
{
|
|
387
425
|
module: 'screen',
|
|
388
426
|
action: 'showTutorialView',
|
|
@@ -398,11 +436,13 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
398
436
|
index: 3,
|
|
399
437
|
name: 'Nitro Fired - Return to HUD',
|
|
400
438
|
screenStep: TUTORIAL_SCREEN_STEP.POWER_UP_RETURN_TO_HUD,
|
|
439
|
+
executePowerUpId: 'battle-nitro',
|
|
401
440
|
listenEvent: {
|
|
402
441
|
on: TUTORIAL_LISTEN_EVENT_ON.CHECKPOINT,
|
|
403
442
|
target: TUTORIAL_CHECKPOINT_TARGET.FINISH,
|
|
404
443
|
},
|
|
405
444
|
triggerCommands: [
|
|
445
|
+
...returnToFinishCommands,
|
|
406
446
|
{
|
|
407
447
|
module: 'screen',
|
|
408
448
|
action: 'showTutorialView',
|
|
@@ -430,6 +470,7 @@ export const allTutorialConfig: TutorialMasterConfig = {
|
|
|
430
470
|
durationMs: 5000,
|
|
431
471
|
},
|
|
432
472
|
triggerCommands: [
|
|
473
|
+
...stopKartCommands,
|
|
433
474
|
{
|
|
434
475
|
module: 'screen',
|
|
435
476
|
action: 'showTutorialView',
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
showLightsColorParamsSchema,
|
|
15
15
|
showLightsEffectParamsSchema,
|
|
16
16
|
speedChangeOptionsSchema,
|
|
17
|
-
speedConfigurationSchema,
|
|
18
17
|
starLaserConfigureModuleOptionsSchema,
|
|
19
18
|
starLaserSendActionsOptionsSchema,
|
|
20
19
|
} from '../hardware';
|
|
@@ -28,11 +27,20 @@ export const changeSpeedActionCommandOptionsSchema = speedChangeOptionsSchema.om
|
|
|
28
27
|
speed: arithmeticOrNumberSchema,
|
|
29
28
|
});
|
|
30
29
|
|
|
30
|
+
export const configureSpeedActionCommandOptionsSchema = z.object({
|
|
31
|
+
defaultSpeed: arithmeticOrNumberSchema,
|
|
32
|
+
timeDuration: arithmeticOrNumberSchema,
|
|
33
|
+
});
|
|
34
|
+
|
|
31
35
|
export const speedModuleCommandSchema = z.union([
|
|
32
36
|
z.object({ module: z.literal('speed'), action: z.literal('activate') }),
|
|
33
37
|
z.object({ module: z.literal('speed'), action: z.literal('deactivate') }),
|
|
34
38
|
z.object({ module: z.literal('speed'), action: z.literal('change'), params: changeSpeedActionCommandOptionsSchema }),
|
|
35
|
-
z.object({
|
|
39
|
+
z.object({
|
|
40
|
+
module: z.literal('speed'),
|
|
41
|
+
action: z.literal('configure'),
|
|
42
|
+
params: configureSpeedActionCommandOptionsSchema,
|
|
43
|
+
}),
|
|
36
44
|
]);
|
|
37
45
|
|
|
38
46
|
// --- Sound Commands ---
|
|
@@ -38,7 +38,7 @@ export const gameSchema = z.object({
|
|
|
38
38
|
finishedReason: gameFinishedReasonSchema.optional(),
|
|
39
39
|
kartsState: z.record(z.string(), gameKartStateSchema),
|
|
40
40
|
gameRanking: z.array(kartRankingItemSchema),
|
|
41
|
-
tutorialConfigId: z.string().optional(),
|
|
41
|
+
tutorialConfigId: z.string().nullable().optional(),
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
export const assignKartSchema = z.object({
|
|
@@ -20,6 +20,8 @@ export const gameTrackKartsConfigSchema = z.object({
|
|
|
20
20
|
diskSensorBallShooter: configDiskSensorBallShooterModuleOptionsSchema,
|
|
21
21
|
ballSensorDiskThrower: configureBallSensorDiskThrowerModuleOptionsSchema,
|
|
22
22
|
lowSpeed: z.number().min(0).max(100),
|
|
23
|
+
tutorialSpeed: z.number().min(0).max(100),
|
|
24
|
+
tutorialReturnSpeed: z.number().min(0).max(100),
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
export const gameTrackKartConfigSchema = z.object({
|
|
@@ -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
|
-
|
|
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,
|
|
@@ -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>;
|