volleyballsimtypes 0.0.503 → 0.0.504
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/service/match/match.d.ts +1 -1
- package/dist/cjs/src/service/match/schemas/match.z.d.ts +1 -0
- package/dist/cjs/src/service/match/schemas/match.z.js +8 -4
- package/dist/cjs/src/stat-config/traits.json +15 -4
- package/dist/esm/src/service/match/match.d.ts +1 -1
- package/dist/esm/src/service/match/schemas/match.z.d.ts +1 -0
- package/dist/esm/src/service/match/schemas/match.z.js +8 -4
- package/dist/esm/src/stat-config/traits.json +15 -4
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Team } from '../team';
|
|
|
3
3
|
import { MatchTeam } from './match-team';
|
|
4
4
|
import { StatusEnum } from '../../data';
|
|
5
5
|
import { VPER } from './vper';
|
|
6
|
-
export type MatchForfeitType = 'INCOMPLETE' | 'DEFAULT';
|
|
6
|
+
export type MatchForfeitType = 'INCOMPLETE' | 'DEFAULT' | 'DOUBLE_FORFEIT';
|
|
7
7
|
export type MatchScore = '3-0' | '3-1' | '3-2' | '2-3' | '1-3' | '0-3';
|
|
8
8
|
export type SetScore = 0 | 1 | 2 | 3;
|
|
9
9
|
export declare class Match {
|
|
@@ -21,6 +21,7 @@ export declare const MatchInputSchema: z.ZodObject<{
|
|
|
21
21
|
forfeitType: z.ZodOptional<z.ZodEnum<{
|
|
22
22
|
INCOMPLETE: "INCOMPLETE";
|
|
23
23
|
DEFAULT: "DEFAULT";
|
|
24
|
+
DOUBLE_FORFEIT: "DOUBLE_FORFEIT";
|
|
24
25
|
}>>;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
export type MatchInput = z.infer<typeof MatchInputSchema>;
|
|
@@ -25,8 +25,8 @@ exports.MatchInputSchema = zod_1.z.object({
|
|
|
25
25
|
awayScore: zod_1.z.number().int().optional(),
|
|
26
26
|
winner: teamSchema.optional(),
|
|
27
27
|
// Abnormal ending marker (see MatchForfeitType). The match still validates as a normal COMPLETE result
|
|
28
|
-
// because forfeited sets carry FIVB-awarded scores.
|
|
29
|
-
forfeitType: zod_1.z.enum(['INCOMPLETE', 'DEFAULT']).optional()
|
|
28
|
+
// because forfeited sets carry FIVB-awarded scores (DOUBLE_FORFEIT is the exception: no winner, 0-0).
|
|
29
|
+
forfeitType: zod_1.z.enum(['INCOMPLETE', 'DEFAULT', 'DOUBLE_FORFEIT']).optional()
|
|
30
30
|
}).superRefine((data, ctx) => {
|
|
31
31
|
if (data.homeTeam.id === data.awayTeam.id) {
|
|
32
32
|
ctx.addIssue({
|
|
@@ -35,9 +35,12 @@ exports.MatchInputSchema = zod_1.z.object({
|
|
|
35
35
|
path: ['awayTeam', 'id']
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
const isDoubleForfeit = data.forfeitType === 'DOUBLE_FORFEIT';
|
|
38
39
|
if (data.sets !== undefined) {
|
|
39
40
|
const n = data.sets.length;
|
|
40
|
-
|
|
41
|
+
// A DOUBLE_FORFEIT (both teams unable to field six) can end at ANY point, so it keeps 0-5 played sets rather
|
|
42
|
+
// than the 0-or-3-to-5 a normal result requires.
|
|
43
|
+
if (isDoubleForfeit ? n > 5 : (n !== 0 && (n < 3 || n > 5))) {
|
|
41
44
|
ctx.addIssue({
|
|
42
45
|
code: 'custom',
|
|
43
46
|
message: 'SETS_LENGTH_MUST_BE_0_OR_BETWEEN_3_AND_5',
|
|
@@ -100,7 +103,8 @@ exports.MatchInputSchema = zod_1.z.object({
|
|
|
100
103
|
path: ['awayScore']
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
|
-
|
|
106
|
+
// A DOUBLE_FORFEIT has NO winner: both sides lose 0-3 (homeScore = awayScore = 0), so the reached-3 rule is waived.
|
|
107
|
+
if (!isDoubleForfeit && homeScore !== 3 && awayScore !== 3) {
|
|
104
108
|
ctx.addIssue({
|
|
105
109
|
code: 'custom',
|
|
106
110
|
message: 'MATCH_COMPLETE_REQUIRES_A_TEAM_TO_HAVE_3_SETS',
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
"OPPOSITE_HITTER",
|
|
33
33
|
"SETTER",
|
|
34
34
|
"OUTSIDE_HITTER"
|
|
35
|
-
]
|
|
35
|
+
],
|
|
36
|
+
"params": {
|
|
37
|
+
"range": 3
|
|
38
|
+
}
|
|
36
39
|
},
|
|
37
40
|
{
|
|
38
41
|
"name": "MARKSMAN",
|
|
@@ -42,7 +45,10 @@
|
|
|
42
45
|
"SETTER",
|
|
43
46
|
"OPPOSITE_HITTER",
|
|
44
47
|
"OUTSIDE_HITTER"
|
|
45
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"params": {
|
|
50
|
+
"primaryScore": 1.1
|
|
51
|
+
}
|
|
46
52
|
},
|
|
47
53
|
{
|
|
48
54
|
"name": "METEOR_SERVE",
|
|
@@ -87,7 +93,10 @@
|
|
|
87
93
|
"roles": [
|
|
88
94
|
"LIBERO",
|
|
89
95
|
"OUTSIDE_HITTER"
|
|
90
|
-
]
|
|
96
|
+
],
|
|
97
|
+
"params": {
|
|
98
|
+
"range": 4
|
|
99
|
+
}
|
|
91
100
|
},
|
|
92
101
|
{
|
|
93
102
|
"name": "DEFENSIVE_SPECIALIST",
|
|
@@ -209,7 +218,9 @@
|
|
|
209
218
|
],
|
|
210
219
|
"params": {
|
|
211
220
|
"servePower": 1.08,
|
|
212
|
-
"attackFactor": 0.66
|
|
221
|
+
"attackFactor": 0.66,
|
|
222
|
+
"frontScore": 1.2,
|
|
223
|
+
"backScore": 1.1
|
|
213
224
|
}
|
|
214
225
|
},
|
|
215
226
|
{
|
|
@@ -3,7 +3,7 @@ import { Team } from '../team';
|
|
|
3
3
|
import { MatchTeam } from './match-team';
|
|
4
4
|
import { StatusEnum } from '../../data';
|
|
5
5
|
import { VPER } from './vper';
|
|
6
|
-
export type MatchForfeitType = 'INCOMPLETE' | 'DEFAULT';
|
|
6
|
+
export type MatchForfeitType = 'INCOMPLETE' | 'DEFAULT' | 'DOUBLE_FORFEIT';
|
|
7
7
|
export type MatchScore = '3-0' | '3-1' | '3-2' | '2-3' | '1-3' | '0-3';
|
|
8
8
|
export type SetScore = 0 | 1 | 2 | 3;
|
|
9
9
|
export declare class Match {
|
|
@@ -21,6 +21,7 @@ export declare const MatchInputSchema: z.ZodObject<{
|
|
|
21
21
|
forfeitType: z.ZodOptional<z.ZodEnum<{
|
|
22
22
|
INCOMPLETE: "INCOMPLETE";
|
|
23
23
|
DEFAULT: "DEFAULT";
|
|
24
|
+
DOUBLE_FORFEIT: "DOUBLE_FORFEIT";
|
|
24
25
|
}>>;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
export type MatchInput = z.infer<typeof MatchInputSchema>;
|
|
@@ -22,8 +22,8 @@ export const MatchInputSchema = z.object({
|
|
|
22
22
|
awayScore: z.number().int().optional(),
|
|
23
23
|
winner: teamSchema.optional(),
|
|
24
24
|
// Abnormal ending marker (see MatchForfeitType). The match still validates as a normal COMPLETE result
|
|
25
|
-
// because forfeited sets carry FIVB-awarded scores.
|
|
26
|
-
forfeitType: z.enum(['INCOMPLETE', 'DEFAULT']).optional()
|
|
25
|
+
// because forfeited sets carry FIVB-awarded scores (DOUBLE_FORFEIT is the exception: no winner, 0-0).
|
|
26
|
+
forfeitType: z.enum(['INCOMPLETE', 'DEFAULT', 'DOUBLE_FORFEIT']).optional()
|
|
27
27
|
}).superRefine((data, ctx) => {
|
|
28
28
|
if (data.homeTeam.id === data.awayTeam.id) {
|
|
29
29
|
ctx.addIssue({
|
|
@@ -32,9 +32,12 @@ export const MatchInputSchema = z.object({
|
|
|
32
32
|
path: ['awayTeam', 'id']
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
const isDoubleForfeit = data.forfeitType === 'DOUBLE_FORFEIT';
|
|
35
36
|
if (data.sets !== undefined) {
|
|
36
37
|
const n = data.sets.length;
|
|
37
|
-
|
|
38
|
+
// A DOUBLE_FORFEIT (both teams unable to field six) can end at ANY point, so it keeps 0-5 played sets rather
|
|
39
|
+
// than the 0-or-3-to-5 a normal result requires.
|
|
40
|
+
if (isDoubleForfeit ? n > 5 : (n !== 0 && (n < 3 || n > 5))) {
|
|
38
41
|
ctx.addIssue({
|
|
39
42
|
code: 'custom',
|
|
40
43
|
message: 'SETS_LENGTH_MUST_BE_0_OR_BETWEEN_3_AND_5',
|
|
@@ -97,7 +100,8 @@ export const MatchInputSchema = z.object({
|
|
|
97
100
|
path: ['awayScore']
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
|
-
|
|
103
|
+
// A DOUBLE_FORFEIT has NO winner: both sides lose 0-3 (homeScore = awayScore = 0), so the reached-3 rule is waived.
|
|
104
|
+
if (!isDoubleForfeit && homeScore !== 3 && awayScore !== 3) {
|
|
101
105
|
ctx.addIssue({
|
|
102
106
|
code: 'custom',
|
|
103
107
|
message: 'MATCH_COMPLETE_REQUIRES_A_TEAM_TO_HAVE_3_SETS',
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
"OPPOSITE_HITTER",
|
|
33
33
|
"SETTER",
|
|
34
34
|
"OUTSIDE_HITTER"
|
|
35
|
-
]
|
|
35
|
+
],
|
|
36
|
+
"params": {
|
|
37
|
+
"range": 3
|
|
38
|
+
}
|
|
36
39
|
},
|
|
37
40
|
{
|
|
38
41
|
"name": "MARKSMAN",
|
|
@@ -42,7 +45,10 @@
|
|
|
42
45
|
"SETTER",
|
|
43
46
|
"OPPOSITE_HITTER",
|
|
44
47
|
"OUTSIDE_HITTER"
|
|
45
|
-
]
|
|
48
|
+
],
|
|
49
|
+
"params": {
|
|
50
|
+
"primaryScore": 1.1
|
|
51
|
+
}
|
|
46
52
|
},
|
|
47
53
|
{
|
|
48
54
|
"name": "METEOR_SERVE",
|
|
@@ -87,7 +93,10 @@
|
|
|
87
93
|
"roles": [
|
|
88
94
|
"LIBERO",
|
|
89
95
|
"OUTSIDE_HITTER"
|
|
90
|
-
]
|
|
96
|
+
],
|
|
97
|
+
"params": {
|
|
98
|
+
"range": 4
|
|
99
|
+
}
|
|
91
100
|
},
|
|
92
101
|
{
|
|
93
102
|
"name": "DEFENSIVE_SPECIALIST",
|
|
@@ -209,7 +218,9 @@
|
|
|
209
218
|
],
|
|
210
219
|
"params": {
|
|
211
220
|
"servePower": 1.08,
|
|
212
|
-
"attackFactor": 0.66
|
|
221
|
+
"attackFactor": 0.66,
|
|
222
|
+
"frontScore": 1.2,
|
|
223
|
+
"backScore": 1.1
|
|
213
224
|
}
|
|
214
225
|
},
|
|
215
226
|
{
|