@battle-racing/br-common-lib
Version:
Common library for all Battle Racing Repositorios
35 lines (34 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.gameSchema = exports.kartRankingItemSchema = exports.gameKartStateSchema = exports.gameWarningEventSchema = exports.gameFinishedReasonSchema = exports.gameStatusSchema = exports.gameTypeSchema = void 0;
const zod_1 = require("zod");
const Game_const_1 = require("./Game.const");
exports.gameTypeSchema = zod_1.z.enum(Game_const_1.GAME_TYPE);
exports.gameStatusSchema = zod_1.z.enum(Game_const_1.GAME_STATUS);
exports.gameFinishedReasonSchema = zod_1.z.enum(Game_const_1.GAME_FINISHED_REASON);
exports.gameWarningEventSchema = zod_1.z.enum(Game_const_1.GAME_WARNING_EVENT);
exports.gameKartStateSchema = zod_1.z.object({
coins: zod_1.z.number(),
});
exports.kartRankingItemSchema = zod_1.z.object({
kartGuid: zod_1.z.string(),
position: zod_1.z.number(),
time: zod_1.z.number(),
});
exports.gameSchema = zod_1.z.object({
id: zod_1.z.number(),
status: exports.gameStatusSchema,
kartsGuids: zod_1.z.array(zod_1.z.string()),
powerUpsIds: zod_1.z.array(zod_1.z.string()),
gameTrackId: zod_1.z.string(),
type: exports.gameTypeSchema,
coins: zod_1.z.number(),
time: zod_1.z.number(),
speedConfig: zod_1.z.number(),
createdAt: zod_1.z.date(),
startedAt: zod_1.z.date().optional(),
finishedAt: zod_1.z.date().optional(),
finishedReason: exports.gameFinishedReasonSchema.optional(),
kartsState: zod_1.z.record(zod_1.z.string(), exports.gameKartStateSchema),
gameRanking: zod_1.z.array(exports.kartRankingItemSchema),
});