@battle-racing/br-common-lib 4.7.0 → 4.8.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.
@@ -16,4 +16,5 @@ export declare const checkpointSchema: z.ZodObject<{
16
16
  readonly UNKNOWN: "Unknown";
17
17
  }>;
18
18
  progress: z.ZodNumber;
19
+ averageTimeSecondsToNext: z.ZodOptional<z.ZodNumber>;
19
20
  }, z.core.$strip>;
@@ -10,4 +10,5 @@ exports.checkpointSchema = zod_1.z.object({
10
10
  name: zod_1.z.string().optional(),
11
11
  type: exports.checkpointTypeSchema,
12
12
  progress: zod_1.z.number(),
13
+ averageTimeSecondsToNext: zod_1.z.number().optional(),
13
14
  });
@@ -16,9 +16,32 @@ export declare const lapTimeSchema: z.ZodObject<{
16
16
  completedAtCheckpointId: z.ZodString;
17
17
  completedAtCheckpointProgress: z.ZodNumber;
18
18
  }, z.core.$strip>;
19
+ export declare const raceTelemetryRecordSchema: z.ZodObject<{
20
+ checkpointId: z.ZodString;
21
+ checkpointProgress: z.ZodNumber;
22
+ timestampISO: z.ZodObject<{
23
+ origin: z.ZodString;
24
+ server: z.ZodString;
25
+ }, z.core.$strip>;
26
+ lap: z.ZodNumber;
27
+ totalProgress: z.ZodNumber;
28
+ kartGuid: z.ZodString;
29
+ raceId: z.ZodNumber;
30
+ createdAt: z.ZodOptional<z.ZodDate>;
31
+ }, z.core.$strip>;
19
32
  export declare const raceKartStateSchema: z.ZodObject<{
20
33
  coins: z.ZodNumber;
21
34
  currentLap: z.ZodNumber;
35
+ totalProgress: z.ZodOptional<z.ZodNumber>;
36
+ latestCheckpointTimeISO: z.ZodOptional<z.ZodString>;
37
+ currentLapStartTimeISO: z.ZodOptional<z.ZodString>;
38
+ lapTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
+ lap: z.ZodNumber;
40
+ timeInSeconds: z.ZodNumber;
41
+ completedAt: z.ZodString;
42
+ completedAtCheckpointId: z.ZodString;
43
+ completedAtCheckpointProgress: z.ZodNumber;
44
+ }, z.core.$strip>>>;
22
45
  }, z.core.$strip>;
23
46
  export declare const raceRankingItemSchema: z.ZodObject<{
24
47
  kartGuid: z.ZodString;
@@ -88,17 +111,17 @@ export declare const raceSchema: z.ZodObject<{
88
111
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
89
112
  coins: z.ZodNumber;
90
113
  currentLap: z.ZodNumber;
114
+ totalProgress: z.ZodOptional<z.ZodNumber>;
115
+ latestCheckpointTimeISO: z.ZodOptional<z.ZodString>;
116
+ currentLapStartTimeISO: z.ZodOptional<z.ZodString>;
117
+ lapTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
118
+ lap: z.ZodNumber;
119
+ timeInSeconds: z.ZodNumber;
120
+ completedAt: z.ZodString;
121
+ completedAtCheckpointId: z.ZodString;
122
+ completedAtCheckpointProgress: z.ZodNumber;
123
+ }, z.core.$strip>>>;
91
124
  }, z.core.$strip>>;
92
- kartsProgress: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
93
- checkpointId: z.ZodString;
94
- checkpointProgress: z.ZodNumber;
95
- timestampISO: z.ZodObject<{
96
- origin: z.ZodString;
97
- server: z.ZodString;
98
- }, z.core.$strip>;
99
- lap: z.ZodNumber;
100
- totalProgress: z.ZodNumber;
101
- }, z.core.$strip>>>;
102
125
  gameRanking: z.ZodArray<z.ZodObject<{
103
126
  kartGuid: z.ZodString;
104
127
  position: z.ZodNumber;
@@ -115,10 +138,9 @@ export declare const raceSchema: z.ZodObject<{
115
138
  }, z.core.$strip>>;
116
139
  }, z.core.$strip>;
117
140
  export declare const raceWithDetailedRankingSchema: z.ZodObject<{
118
- type: z.ZodLiteral<"Race">;
119
141
  id: z.ZodNumber;
120
- coins: z.ZodNumber;
121
- laps: z.ZodNumber;
142
+ gameTurnId: z.ZodOptional<z.ZodString>;
143
+ isOfficial: z.ZodDefault<z.ZodBoolean>;
122
144
  status: z.ZodEnum<{
123
145
  readonly NON_STARTED: "non-started";
124
146
  readonly ACTIVE: "active";
@@ -127,13 +149,12 @@ export declare const raceWithDetailedRankingSchema: z.ZodObject<{
127
149
  readonly FINISHED: "finished";
128
150
  readonly KART_ELIMINATED: "kart-eliminated";
129
151
  }>;
130
- time: z.ZodNumber;
131
- gameTurnId: z.ZodOptional<z.ZodString>;
132
- isOfficial: z.ZodDefault<z.ZodBoolean>;
133
152
  kartsGuids: z.ZodArray<z.ZodString>;
134
153
  playerKartMap: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
135
154
  powerUpsIds: z.ZodArray<z.ZodString>;
136
155
  gameTrackId: z.ZodString;
156
+ coins: z.ZodNumber;
157
+ time: z.ZodNumber;
137
158
  speedConfig: z.ZodNumber;
138
159
  createdAt: z.ZodDate;
139
160
  startedAt: z.ZodOptional<z.ZodDate>;
@@ -144,9 +165,21 @@ export declare const raceWithDetailedRankingSchema: z.ZodObject<{
144
165
  readonly EMERGENCY: "EMERGENCY";
145
166
  readonly BY_CONTROLLER: "BY_CONTROLLER";
146
167
  }>>;
168
+ type: z.ZodLiteral<"Race">;
169
+ laps: z.ZodNumber;
147
170
  kartsState: z.ZodRecord<z.ZodString, z.ZodObject<{
148
171
  coins: z.ZodNumber;
149
172
  currentLap: z.ZodNumber;
173
+ totalProgress: z.ZodOptional<z.ZodNumber>;
174
+ latestCheckpointTimeISO: z.ZodOptional<z.ZodString>;
175
+ currentLapStartTimeISO: z.ZodOptional<z.ZodString>;
176
+ lapTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
+ lap: z.ZodNumber;
178
+ timeInSeconds: z.ZodNumber;
179
+ completedAt: z.ZodString;
180
+ completedAtCheckpointId: z.ZodString;
181
+ completedAtCheckpointProgress: z.ZodNumber;
182
+ }, z.core.$strip>>>;
150
183
  }, z.core.$strip>>;
151
184
  gameRanking: z.ZodArray<z.ZodObject<{
152
185
  kartGuid: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRaceSchema = exports.startRaceSchema = exports.kartLapTimesSchema = exports.raceWithDetailedRankingSchema = exports.raceSchema = exports.rankingWithKartsAndLapTimesSchema = exports.raceRankingItemSchema = exports.raceKartStateSchema = exports.lapTimeSchema = exports.kartProgressSchema = void 0;
3
+ exports.createRaceSchema = exports.startRaceSchema = exports.kartLapTimesSchema = exports.raceWithDetailedRankingSchema = exports.raceSchema = exports.rankingWithKartsAndLapTimesSchema = exports.raceRankingItemSchema = exports.raceKartStateSchema = exports.raceTelemetryRecordSchema = exports.lapTimeSchema = exports.kartProgressSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const Game_const_1 = require("../Game.const");
6
6
  const Game_schema_1 = require("../Game.schema");
@@ -22,8 +22,17 @@ exports.lapTimeSchema = zod_1.z.object({
22
22
  completedAtCheckpointId: zod_1.z.string(),
23
23
  completedAtCheckpointProgress: zod_1.z.number(),
24
24
  });
25
+ exports.raceTelemetryRecordSchema = exports.kartProgressSchema.extend({
26
+ kartGuid: zod_1.z.string(),
27
+ raceId: zod_1.z.number(),
28
+ createdAt: zod_1.z.date().optional(),
29
+ });
25
30
  exports.raceKartStateSchema = Game_schema_1.gameKartStateSchema.extend({
26
31
  currentLap: zod_1.z.number(),
32
+ totalProgress: zod_1.z.number().optional(),
33
+ latestCheckpointTimeISO: zod_1.z.string().optional(),
34
+ currentLapStartTimeISO: zod_1.z.string().optional(),
35
+ lapTimes: zod_1.z.array(exports.lapTimeSchema).optional(),
27
36
  });
28
37
  exports.raceRankingItemSchema = Game_schema_1.kartRankingItemSchema.extend({
29
38
  progress: zod_1.z.number(),
@@ -39,10 +48,9 @@ exports.raceSchema = Game_schema_1.gameSchema.extend({
39
48
  type: zod_1.z.literal(Game_const_1.GAME_TYPE.Race),
40
49
  laps: zod_1.z.number(),
41
50
  kartsState: zod_1.z.record(zod_1.z.string(), exports.raceKartStateSchema),
42
- kartsProgress: zod_1.z.record(zod_1.z.string(), zod_1.z.array(exports.kartProgressSchema)),
43
51
  gameRanking: zod_1.z.array(exports.raceRankingItemSchema),
44
52
  });
45
- exports.raceWithDetailedRankingSchema = exports.raceSchema.omit({ kartsProgress: true }).extend({
53
+ exports.raceWithDetailedRankingSchema = exports.raceSchema.extend({
46
54
  gameRanking: zod_1.z.array(exports.rankingWithKartsAndLapTimesSchema),
47
55
  });
48
56
  exports.kartLapTimesSchema = zod_1.z.object({
@@ -1,8 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { createRaceSchema, kartLapTimesSchema, kartProgressSchema, lapTimeSchema, raceKartStateSchema, raceRankingItemSchema, raceSchema, raceWithDetailedRankingSchema, rankingWithKartsAndLapTimesSchema, startRaceSchema } from './Race.schema';
2
+ import { createRaceSchema, kartLapTimesSchema, kartProgressSchema, lapTimeSchema, raceKartStateSchema, raceRankingItemSchema, raceSchema, raceWithDetailedRankingSchema, rankingWithKartsAndLapTimesSchema, startRaceSchema, raceTelemetryRecordSchema } from './Race.schema';
3
3
  export type KartProgress = z.infer<typeof kartProgressSchema>;
4
4
  export type LapTime = z.infer<typeof lapTimeSchema>;
5
5
  export type KartLapTimes = z.infer<typeof kartLapTimesSchema>;
6
+ export type RaceTelemetryRecord = z.infer<typeof raceTelemetryRecordSchema>;
6
7
  export type RaceKartState = z.infer<typeof raceKartStateSchema>;
7
8
  export type RaceRankingItem = z.infer<typeof raceRankingItemSchema>;
8
9
  export type RankingWithKartsAndLapTimes = z.infer<typeof rankingWithKartsAndLapTimesSchema>;
@@ -56,6 +56,7 @@ export declare const gameTrackSchema: z.ZodObject<{
56
56
  readonly UNKNOWN: "Unknown";
57
57
  }>;
58
58
  progress: z.ZodNumber;
59
+ averageTimeSecondsToNext: z.ZodOptional<z.ZodNumber>;
59
60
  }, z.core.$strip>>;
60
61
  kartsConfig: z.ZodObject<{
61
62
  defaultSpeed: z.ZodNumber;
@@ -10,6 +10,7 @@ export declare const checkpointEventSchema: z.ZodObject<{
10
10
  readonly UNKNOWN: "Unknown";
11
11
  }>;
12
12
  progress: z.ZodNumber;
13
+ averageTimeSecondsToNext: z.ZodOptional<z.ZodNumber>;
13
14
  index: z.ZodNumber;
14
15
  timestampISO: z.ZodObject<{
15
16
  origin: z.ZodString;
@@ -29,6 +30,7 @@ export declare const kartTrackingSchema: z.ZodObject<{
29
30
  readonly UNKNOWN: "Unknown";
30
31
  }>;
31
32
  progress: z.ZodNumber;
33
+ averageTimeSecondsToNext: z.ZodOptional<z.ZodNumber>;
32
34
  index: z.ZodNumber;
33
35
  timestampISO: z.ZodObject<{
34
36
  origin: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -9,4 +9,5 @@ export const checkpointSchema = z.object({
9
9
  name: z.string().optional(),
10
10
  type: checkpointTypeSchema,
11
11
  progress: z.number(),
12
+ averageTimeSecondsToNext: z.number().optional(),
12
13
  });
@@ -23,8 +23,18 @@ export const lapTimeSchema = z.object({
23
23
  completedAtCheckpointProgress: z.number(),
24
24
  });
25
25
 
26
+ export const raceTelemetryRecordSchema = kartProgressSchema.extend({
27
+ kartGuid: z.string(),
28
+ raceId: z.number(),
29
+ createdAt: z.date().optional(),
30
+ });
31
+
26
32
  export const raceKartStateSchema = gameKartStateSchema.extend({
27
33
  currentLap: z.number(),
34
+ totalProgress: z.number().optional(),
35
+ latestCheckpointTimeISO: z.string().optional(),
36
+ currentLapStartTimeISO: z.string().optional(),
37
+ lapTimes: z.array(lapTimeSchema).optional(),
28
38
  });
29
39
 
30
40
  export const raceRankingItemSchema = kartRankingItemSchema.extend({
@@ -44,11 +54,10 @@ export const raceSchema = gameSchema.extend({
44
54
  type: z.literal(GAME_TYPE.Race),
45
55
  laps: z.number(),
46
56
  kartsState: z.record(z.string(), raceKartStateSchema),
47
- kartsProgress: z.record(z.string(), z.array(kartProgressSchema)),
48
57
  gameRanking: z.array(raceRankingItemSchema),
49
58
  });
50
59
 
51
- export const raceWithDetailedRankingSchema = raceSchema.omit({ kartsProgress: true }).extend({
60
+ export const raceWithDetailedRankingSchema = raceSchema.extend({
52
61
  gameRanking: z.array(rankingWithKartsAndLapTimesSchema),
53
62
  });
54
63
 
@@ -10,11 +10,13 @@ import {
10
10
  raceWithDetailedRankingSchema,
11
11
  rankingWithKartsAndLapTimesSchema,
12
12
  startRaceSchema,
13
+ raceTelemetryRecordSchema,
13
14
  } from './Race.schema';
14
15
 
15
16
  export type KartProgress = z.infer<typeof kartProgressSchema>;
16
17
  export type LapTime = z.infer<typeof lapTimeSchema>;
17
18
  export type KartLapTimes = z.infer<typeof kartLapTimesSchema>;
19
+ export type RaceTelemetryRecord = z.infer<typeof raceTelemetryRecordSchema>;
18
20
 
19
21
  export type RaceKartState = z.infer<typeof raceKartStateSchema>;
20
22
  export type RaceRankingItem = z.infer<typeof raceRankingItemSchema>;