volleyballsimtypes 0.0.465 → 0.0.469
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/dist/cjs/src/api/index.d.ts +2 -1
- package/dist/cjs/src/service/player/injury.d.ts +2 -1
- package/dist/cjs/src/service/player/injury.js +1 -0
- package/dist/cjs/src/service/player/injury.test.js +2 -1
- package/dist/cjs/src/service/player/schemas/player.z.js +1 -1
- package/dist/esm/src/api/index.d.ts +2 -1
- package/dist/esm/src/service/player/injury.d.ts +2 -1
- package/dist/esm/src/service/player/injury.js +1 -0
- package/dist/esm/src/service/player/injury.test.js +2 -1
- package/dist/esm/src/service/player/schemas/player.z.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition, ConditionLogic, EnergyBand, LiberoSubMode, PerformanceStats, PinchCondition, RotationSystemEnum, SubBand, SubMode } from '../service';
|
|
1
|
+
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition, ConditionLogic, EnergyBand, LiberoSubMode, MatchForfeitType, PerformanceStats, PinchCondition, RotationSystemEnum, SubBand, SubMode } from '../service';
|
|
2
2
|
export type Rally = DataProps<_Rally> & {
|
|
3
3
|
homePlayerPosition: PlayerPosition[];
|
|
4
4
|
awayPlayerPosition: PlayerPosition[];
|
|
@@ -30,6 +30,7 @@ export interface MatchForm {
|
|
|
30
30
|
side: 'HOME' | 'AWAY';
|
|
31
31
|
opponent: string;
|
|
32
32
|
dR: number;
|
|
33
|
+
forfeit?: MatchForfeitType;
|
|
33
34
|
}
|
|
34
35
|
export type Match = Omit<DataProps<_Match>, 'sets' | 'homeTeam' | 'awayTeam' | 'VPERs'> & {
|
|
35
36
|
sets: MatchSet[];
|
|
@@ -10,6 +10,7 @@ var InjurySeverityEnum;
|
|
|
10
10
|
InjurySeverityEnum[InjurySeverityEnum["MINOR"] = 1] = "MINOR";
|
|
11
11
|
InjurySeverityEnum[InjurySeverityEnum["MODERATE"] = 2] = "MODERATE";
|
|
12
12
|
InjurySeverityEnum[InjurySeverityEnum["SEVERE"] = 3] = "SEVERE";
|
|
13
|
+
InjurySeverityEnum[InjurySeverityEnum["CRITICAL"] = 4] = "CRITICAL";
|
|
13
14
|
})(InjurySeverityEnum || (exports.InjurySeverityEnum = InjurySeverityEnum = {}));
|
|
14
15
|
// A long-term injury is active while `at` is before injuredUntil.
|
|
15
16
|
function hasActiveInjury(injury, at) {
|
|
@@ -26,7 +26,8 @@ const test_helpers_1 = require("../test-helpers");
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
(0, globals_1.it)('rejects out-of-range severity and profile', () => {
|
|
29
|
-
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(
|
|
29
|
+
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(true);
|
|
30
|
+
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 5, injuredUntil: new Date() } }).success).toBe(false);
|
|
30
31
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 0, injuredUntil: new Date() } }).success).toBe(false);
|
|
31
32
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: 1.2 }).success).toBe(false);
|
|
32
33
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: -0.1 }).success).toBe(false);
|
|
@@ -41,7 +41,7 @@ exports.PlayerInputSchema = zod_1.z.object({
|
|
|
41
41
|
// Defaulted so every existing Player.create caller (generator, transformers, test helpers) stays valid.
|
|
42
42
|
injuryProneProfile: zod_1.z.number().min(0).max(1).default(0.5),
|
|
43
43
|
injury: zod_1.z.object({
|
|
44
|
-
severity: zod_1.z.number().int().min(1).max(
|
|
44
|
+
severity: zod_1.z.number().int().min(1).max(4),
|
|
45
45
|
injuredUntil: zod_1.z.coerce.date(),
|
|
46
46
|
debuff: zod_1.z.number().min(0).max(1).optional()
|
|
47
47
|
}).optional(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition, ConditionLogic, EnergyBand, LiberoSubMode, PerformanceStats, PinchCondition, RotationSystemEnum, SubBand, SubMode } from '../service';
|
|
1
|
+
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition, ConditionLogic, EnergyBand, LiberoSubMode, MatchForfeitType, PerformanceStats, PinchCondition, RotationSystemEnum, SubBand, SubMode } from '../service';
|
|
2
2
|
export type Rally = DataProps<_Rally> & {
|
|
3
3
|
homePlayerPosition: PlayerPosition[];
|
|
4
4
|
awayPlayerPosition: PlayerPosition[];
|
|
@@ -30,6 +30,7 @@ export interface MatchForm {
|
|
|
30
30
|
side: 'HOME' | 'AWAY';
|
|
31
31
|
opponent: string;
|
|
32
32
|
dR: number;
|
|
33
|
+
forfeit?: MatchForfeitType;
|
|
33
34
|
}
|
|
34
35
|
export type Match = Omit<DataProps<_Match>, 'sets' | 'homeTeam' | 'awayTeam' | 'VPERs'> & {
|
|
35
36
|
sets: MatchSet[];
|
|
@@ -4,6 +4,7 @@ export var InjurySeverityEnum;
|
|
|
4
4
|
InjurySeverityEnum[InjurySeverityEnum["MINOR"] = 1] = "MINOR";
|
|
5
5
|
InjurySeverityEnum[InjurySeverityEnum["MODERATE"] = 2] = "MODERATE";
|
|
6
6
|
InjurySeverityEnum[InjurySeverityEnum["SEVERE"] = 3] = "SEVERE";
|
|
7
|
+
InjurySeverityEnum[InjurySeverityEnum["CRITICAL"] = 4] = "CRITICAL";
|
|
7
8
|
})(InjurySeverityEnum || (InjurySeverityEnum = {}));
|
|
8
9
|
// A long-term injury is active while `at` is before injuredUntil.
|
|
9
10
|
export function hasActiveInjury(injury, at) {
|
|
@@ -24,7 +24,8 @@ describe('Player injury fields', () => {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
it('rejects out-of-range severity and profile', () => {
|
|
27
|
-
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(
|
|
27
|
+
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(true);
|
|
28
|
+
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 5, injuredUntil: new Date() } }).success).toBe(false);
|
|
28
29
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 0, injuredUntil: new Date() } }).success).toBe(false);
|
|
29
30
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: 1.2 }).success).toBe(false);
|
|
30
31
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: -0.1 }).success).toBe(false);
|
|
@@ -38,7 +38,7 @@ export const PlayerInputSchema = z.object({
|
|
|
38
38
|
// Defaulted so every existing Player.create caller (generator, transformers, test helpers) stays valid.
|
|
39
39
|
injuryProneProfile: z.number().min(0).max(1).default(0.5),
|
|
40
40
|
injury: z.object({
|
|
41
|
-
severity: z.number().int().min(1).max(
|
|
41
|
+
severity: z.number().int().min(1).max(4),
|
|
42
42
|
injuredUntil: z.coerce.date(),
|
|
43
43
|
debuff: z.number().min(0).max(1).optional()
|
|
44
44
|
}).optional(),
|