volleyballsimtypes 0.0.481 → 0.0.483
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 +10 -18
- package/dist/cjs/src/data/models/tactics.d.ts +17 -19
- package/dist/cjs/src/data/models/tactics.js +9 -0
- package/dist/cjs/src/data/transformers/match-preset-override.test.js +10 -1
- package/dist/cjs/src/data/transformers/rally-event.d.ts +2 -1
- package/dist/cjs/src/data/transformers/rally-event.js +12 -0
- package/dist/cjs/src/data/transformers/rally.js +2 -0
- package/dist/cjs/src/data/transformers/rally.test.d.ts +1 -0
- package/dist/cjs/src/data/transformers/rally.test.js +62 -0
- package/dist/cjs/src/data/transformers/tactics.js +38 -58
- package/dist/cjs/src/data/transformers/tactics.test.js +39 -20
- package/dist/cjs/src/service/team/blocking-preference.d.ts +5 -0
- package/dist/cjs/src/service/team/blocking-preference.js +2 -0
- package/dist/cjs/src/service/team/designated-sub.d.ts +2 -4
- package/dist/cjs/src/service/team/index.d.ts +2 -0
- package/dist/cjs/src/service/team/index.js +2 -0
- package/dist/cjs/src/service/team/libero-sub.d.ts +0 -4
- package/dist/cjs/src/service/team/offensive-preference.d.ts +1 -2
- package/dist/cjs/src/service/team/pinch-condition.d.ts +11 -3
- package/dist/cjs/src/service/team/pinch-condition.js +9 -4
- package/dist/cjs/src/service/team/schemas/designated-sub.z.d.ts +30 -32
- package/dist/cjs/src/service/team/schemas/designated-sub.z.js +27 -23
- package/dist/cjs/src/service/team/schemas/designated-sub.z.test.js +4 -2
- package/dist/cjs/src/service/team/schemas/libero-sub.z.d.ts +15 -34
- package/dist/cjs/src/service/team/schemas/libero-sub.z.js +10 -26
- package/dist/cjs/src/service/team/schemas/libero-sub.z.test.js +74 -35
- package/dist/cjs/src/service/team/schemas/tactics.z.d.ts +39 -39
- package/dist/cjs/src/service/team/schemas/tactics.z.js +47 -13
- package/dist/cjs/src/service/team/schemas/tactics.z.test.js +81 -8
- package/dist/cjs/src/service/team/schemas/team.z.d.ts +38 -38
- package/dist/cjs/src/service/team/sub-config-convert.d.ts +13 -0
- package/dist/cjs/src/service/team/sub-config-convert.js +91 -0
- package/dist/cjs/src/service/team/sub-config-convert.test.d.ts +1 -0
- package/dist/cjs/src/service/team/sub-config-convert.test.js +84 -0
- package/dist/cjs/src/service/team/tactics.d.ts +5 -0
- package/dist/cjs/src/service/team/tactics.js +3 -1
- package/dist/esm/src/api/index.d.ts +10 -18
- package/dist/esm/src/data/models/tactics.d.ts +17 -19
- package/dist/esm/src/data/models/tactics.js +9 -0
- package/dist/esm/src/data/transformers/match-preset-override.test.js +10 -1
- package/dist/esm/src/data/transformers/rally-event.d.ts +2 -1
- package/dist/esm/src/data/transformers/rally-event.js +12 -1
- package/dist/esm/src/data/transformers/rally.js +4 -2
- package/dist/esm/src/data/transformers/rally.test.d.ts +1 -0
- package/dist/esm/src/data/transformers/rally.test.js +60 -0
- package/dist/esm/src/data/transformers/tactics.js +39 -59
- package/dist/esm/src/data/transformers/tactics.test.js +40 -21
- package/dist/esm/src/service/team/blocking-preference.d.ts +5 -0
- package/dist/esm/src/service/team/blocking-preference.js +1 -0
- package/dist/esm/src/service/team/designated-sub.d.ts +2 -4
- package/dist/esm/src/service/team/index.d.ts +2 -0
- package/dist/esm/src/service/team/index.js +2 -0
- package/dist/esm/src/service/team/libero-sub.d.ts +0 -4
- package/dist/esm/src/service/team/offensive-preference.d.ts +1 -2
- package/dist/esm/src/service/team/pinch-condition.d.ts +11 -3
- package/dist/esm/src/service/team/pinch-condition.js +9 -4
- package/dist/esm/src/service/team/schemas/designated-sub.z.d.ts +30 -32
- package/dist/esm/src/service/team/schemas/designated-sub.z.js +26 -22
- package/dist/esm/src/service/team/schemas/designated-sub.z.test.js +4 -2
- package/dist/esm/src/service/team/schemas/libero-sub.z.d.ts +15 -34
- package/dist/esm/src/service/team/schemas/libero-sub.z.js +9 -25
- package/dist/esm/src/service/team/schemas/libero-sub.z.test.js +75 -36
- package/dist/esm/src/service/team/schemas/tactics.z.d.ts +39 -39
- package/dist/esm/src/service/team/schemas/tactics.z.js +48 -14
- package/dist/esm/src/service/team/schemas/tactics.z.test.js +81 -8
- package/dist/esm/src/service/team/schemas/team.z.d.ts +38 -38
- package/dist/esm/src/service/team/sub-config-convert.d.ts +13 -0
- package/dist/esm/src/service/team/sub-config-convert.js +85 -0
- package/dist/esm/src/service/team/sub-config-convert.test.d.ts +1 -0
- package/dist/esm/src/service/team/sub-config-convert.test.js +82 -0
- package/dist/esm/src/service/team/tactics.d.ts +5 -0
- package/dist/esm/src/service/team/tactics.js +3 -1
- package/package.json +1 -1
|
@@ -26,7 +26,8 @@ function makeTactics(designatedSubs) {
|
|
|
26
26
|
libero_replacement_sets: undefined,
|
|
27
27
|
rotation_system: '5-1',
|
|
28
28
|
designated_setters: ['lf'],
|
|
29
|
-
offensive_preferences: [{ rotation: 1,
|
|
29
|
+
offensive_preferences: [{ rotation: 1, weights: { lf: 60, rf: 40 } }],
|
|
30
|
+
blocking_preferences: []
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
(0, globals_1.describe)('tacticsColumnsToApiDto()', () => {
|
|
@@ -37,27 +38,30 @@ function makeTactics(designatedSubs) {
|
|
|
37
38
|
(0, globals_1.expect)(dto.rotationSystem).toBe('5-1');
|
|
38
39
|
(0, globals_1.expect)(dto.liberoReplacements).toEqual(['lf']);
|
|
39
40
|
(0, globals_1.expect)(dto.lineup.bench).toEqual(['b1', 'b2']);
|
|
40
|
-
(0, globals_1.expect)(dto.offensivePreferences).toEqual([{ rotation: 1,
|
|
41
|
+
(0, globals_1.expect)(dto.offensivePreferences).toEqual([{ rotation: 1, weights: { lf: 60, rf: 40 } }]);
|
|
41
42
|
});
|
|
42
|
-
(0, globals_1.it)(
|
|
43
|
+
(0, globals_1.it)('converts a legacy isPinchServer entry to a unified pinch server (conditions kept, no mode)', () => {
|
|
43
44
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([
|
|
44
45
|
{ starterId: 's1', benchId: 'b1', isPinchServer: true, conditions: [{ type: 'ASAP' }] }
|
|
45
46
|
]));
|
|
46
|
-
(0, globals_1.expect)(dto.designatedSubs[0].
|
|
47
|
+
(0, globals_1.expect)(dto.designatedSubs[0].pinchServer).toBe(true);
|
|
48
|
+
(0, globals_1.expect)(dto.designatedSubs[0].conditions).toEqual([{ type: 'ASAP' }]);
|
|
49
|
+
(0, globals_1.expect)(dto.designatedSubs[0].mode).toBeUndefined();
|
|
47
50
|
});
|
|
48
|
-
(0, globals_1.it)("
|
|
51
|
+
(0, globals_1.it)("converts a legacy 'NEVER' fatigueBand to an explicit empty condition list", () => {
|
|
49
52
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([
|
|
50
53
|
{ starterId: 's1', fatigueBand: 'NEVER' }
|
|
51
54
|
]));
|
|
52
|
-
(0, globals_1.expect)(dto.designatedSubs[0].
|
|
55
|
+
(0, globals_1.expect)(dto.designatedSubs[0].conditions).toEqual([]);
|
|
53
56
|
(0, globals_1.expect)(dto.designatedSubs[0].fatigueBand).toBeUndefined();
|
|
54
57
|
});
|
|
55
|
-
(0, globals_1.it)('
|
|
58
|
+
(0, globals_1.it)('converts a legacy fatigue entry to a FATIGUE condition carrying its band', () => {
|
|
56
59
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([
|
|
57
60
|
{ starterId: 's1', benchId: 'b1', mode: 'FATIGUE', fatigueBand: service_1.EnergyBand.WORN, benchFatigueBand: service_1.EnergyBand.TIRED }
|
|
58
61
|
]));
|
|
59
|
-
(0, globals_1.expect)(dto.designatedSubs[0].
|
|
60
|
-
(0, globals_1.expect)(dto.designatedSubs[0].
|
|
62
|
+
(0, globals_1.expect)(dto.designatedSubs[0].conditions).toEqual([{ type: 'FATIGUE', band: service_1.EnergyBand.WORN }]);
|
|
63
|
+
(0, globals_1.expect)(dto.designatedSubs[0].subBackMode).toBe('FATIGUE');
|
|
64
|
+
(0, globals_1.expect)(dto.designatedSubs[0].pinchServer).toBe(false);
|
|
61
65
|
(0, globals_1.expect)(dto.designatedSubs[0].benchFatigueBand).toBe(service_1.EnergyBand.TIRED);
|
|
62
66
|
});
|
|
63
67
|
(0, globals_1.it)('defaults a legacy PINCH row (no pinchServer flag) to pinchServer true', () => {
|
|
@@ -66,11 +70,12 @@ function makeTactics(designatedSubs) {
|
|
|
66
70
|
]));
|
|
67
71
|
(0, globals_1.expect)(dto.designatedSubs[0].pinchServer).toBe(true);
|
|
68
72
|
});
|
|
69
|
-
(0, globals_1.it)('
|
|
73
|
+
(0, globals_1.it)('passes an already-unified entry through untouched', () => {
|
|
70
74
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([
|
|
71
|
-
{ starterId: 's1', benchId: 'b1',
|
|
75
|
+
{ starterId: 's1', benchId: 'b1', conditions: [{ type: 'FATIGUE', band: service_1.EnergyBand.TIRED }], conditionLogic: 'ALL', pinchServer: false, subBackMode: 'FATIGUE' }
|
|
72
76
|
]));
|
|
73
|
-
(0, globals_1.expect)(dto.designatedSubs[0].
|
|
77
|
+
(0, globals_1.expect)(dto.designatedSubs[0].conditions).toEqual([{ type: 'FATIGUE', band: service_1.EnergyBand.TIRED }]);
|
|
78
|
+
(0, globals_1.expect)(dto.designatedSubs[0].pinchServer).toBe(false);
|
|
74
79
|
});
|
|
75
80
|
(0, globals_1.it)('passes a conditional regular sub (pinchServer false + condition sub-back) through unchanged', () => {
|
|
76
81
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([
|
|
@@ -107,7 +112,8 @@ function makeTactics(designatedSubs) {
|
|
|
107
112
|
model.libero_sub = { mode: 'FATIGUE' };
|
|
108
113
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(model);
|
|
109
114
|
(0, globals_1.expect)(dto.secondLibero).toBe('reserve1');
|
|
110
|
-
|
|
115
|
+
// Legacy FATIGUE libero rule converts to the unified condition shape on the API read path.
|
|
116
|
+
(0, globals_1.expect)(dto.liberoSub).toEqual({ conditions: [{ type: 'FATIGUE' }], conditionLogic: 'ALL' });
|
|
111
117
|
});
|
|
112
118
|
(0, globals_1.it)('keeps a libero-keyed replaceKnockedImmediately entry when a second libero exists (L2-only feature)', () => {
|
|
113
119
|
const model = makeTactics([]);
|
|
@@ -127,10 +133,10 @@ function makeTactics(designatedSubs) {
|
|
|
127
133
|
(0, globals_1.it)('passes per-set tactics columns through to the API DTO shape', () => {
|
|
128
134
|
const model = makeTactics([]);
|
|
129
135
|
model.system_sets = [{ rotationSystem: service_1.RotationSystemEnum.FIVE_ONE, designatedSetters: ['lf'] }];
|
|
130
|
-
model.offensive_preference_sets = [[{ rotation: 1,
|
|
136
|
+
model.offensive_preference_sets = [[{ rotation: 1, weights: { rf: 55, mf: 45 } }]];
|
|
131
137
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(model);
|
|
132
138
|
(0, globals_1.expect)(dto.systemSets).toEqual([{ rotationSystem: '5-1', designatedSetters: ['lf'] }]);
|
|
133
|
-
(0, globals_1.expect)(dto.offensivePreferenceSets).toEqual([[{ rotation: 1,
|
|
139
|
+
(0, globals_1.expect)(dto.offensivePreferenceSets).toEqual([[{ rotation: 1, weights: { rf: 55, mf: 45 } }]]);
|
|
134
140
|
});
|
|
135
141
|
(0, globals_1.it)('leaves the per-set DTO fields undefined when the columns are absent', () => {
|
|
136
142
|
const dto = (0, tactics_1.tacticsColumnsToApiDto)(makeTactics([]));
|
|
@@ -154,7 +160,7 @@ function makeTactics(designatedSubs) {
|
|
|
154
160
|
{ rotationSystem: service_1.RotationSystemEnum.FIVE_ONE, designatedSetters: [p1] },
|
|
155
161
|
{ rotationSystem: service_1.RotationSystemEnum.SIX_ZERO, designatedSetters: [] }
|
|
156
162
|
],
|
|
157
|
-
offensivePreferenceSets: [[{ rotation: 1,
|
|
163
|
+
offensivePreferenceSets: [[{ rotation: 1, weights: { [p2.id]: 60, [p3.id]: 40 } }]]
|
|
158
164
|
});
|
|
159
165
|
(0, globals_1.it)('transformFromTactics writes the per-set overrides as id-based jsonb columns', () => {
|
|
160
166
|
const attrs = (0, tactics_1.transformFromTactics)(tactics, 'team-1');
|
|
@@ -162,7 +168,7 @@ function makeTactics(designatedSubs) {
|
|
|
162
168
|
{ rotationSystem: '5-1', designatedSetters: [p1.id] },
|
|
163
169
|
{ rotationSystem: '6-0', designatedSetters: [] }
|
|
164
170
|
]);
|
|
165
|
-
(0, globals_1.expect)(attrs.offensive_preference_sets).toEqual([[{ rotation: 1,
|
|
171
|
+
(0, globals_1.expect)(attrs.offensive_preference_sets).toEqual([[{ rotation: 1, weights: { [p2.id]: 60, [p3.id]: 40 } }]]);
|
|
166
172
|
});
|
|
167
173
|
(0, globals_1.it)('transformToTactics resolves the stored ids back to roster players', () => {
|
|
168
174
|
const attrs = (0, tactics_1.transformFromTactics)(tactics, 'team-1');
|
|
@@ -170,7 +176,7 @@ function makeTactics(designatedSubs) {
|
|
|
170
176
|
(0, globals_1.expect)(back.systemSets?.[0].rotationSystem).toBe(service_1.RotationSystemEnum.FIVE_ONE);
|
|
171
177
|
(0, globals_1.expect)(back.systemSets?.[0].designatedSetters[0].id).toBe(p1.id);
|
|
172
178
|
(0, globals_1.expect)(back.systemSets?.[1].designatedSetters).toEqual([]);
|
|
173
|
-
(0, globals_1.expect)(back.offensivePreferenceSets?.[0][0].
|
|
179
|
+
(0, globals_1.expect)(back.offensivePreferenceSets?.[0][0].weights).toEqual({ [p2.id]: 60, [p3.id]: 40 });
|
|
174
180
|
});
|
|
175
181
|
(0, globals_1.it)('omits the per-set columns entirely for an all-sets config', () => {
|
|
176
182
|
const flat = service_1.Tactics.create({
|
|
@@ -188,15 +194,28 @@ function makeTactics(designatedSubs) {
|
|
|
188
194
|
const withTempos = service_1.Tactics.create({
|
|
189
195
|
lineup: { 4: p4, 3: p3, 2: p2, 5: p5, 6: p6, 1: p1, bench: [] },
|
|
190
196
|
liberoReplacements: [],
|
|
191
|
-
offensivePreferences: [{ rotation: 1,
|
|
197
|
+
offensivePreferences: [{ rotation: 1, weights: { [p2.id]: 60, [p3.id]: 40 }, tempos: { [p2.id]: 'FAST', [p3.id]: 'HIGH' } }]
|
|
192
198
|
});
|
|
193
199
|
const attrs = (0, tactics_1.transformFromTactics)(withTempos, 'team-1');
|
|
194
200
|
(0, globals_1.expect)(attrs.offensive_preferences).toEqual([
|
|
195
|
-
{ rotation: 1,
|
|
201
|
+
{ rotation: 1, weights: { [p2.id]: 60, [p3.id]: 40 }, tempos: { [p2.id]: 'FAST', [p3.id]: 'HIGH' } }
|
|
196
202
|
]);
|
|
197
203
|
const back = (0, tactics_1.transformToTactics)(attrs, roster);
|
|
198
204
|
(0, globals_1.expect)(back.offensivePreferences[0].tempos).toEqual({ [p2.id]: 'FAST', [p3.id]: 'HIGH' });
|
|
199
205
|
});
|
|
206
|
+
(0, globals_1.it)('round-trips blocking preferences as id-keyed function maps', () => {
|
|
207
|
+
const withBlocking = service_1.Tactics.create({
|
|
208
|
+
lineup: { 4: p4, 3: p3, 2: p2, 5: p5, 6: p6, 1: p1, bench: [] },
|
|
209
|
+
liberoReplacements: [],
|
|
210
|
+
blockingPreferences: [{ rotation: 1, targets: { [p4.id]: service_1.RoleEnum.OUTSIDE_HITTER, [p3.id]: service_1.RoleEnum.MIDDLE_BLOCKER } }]
|
|
211
|
+
});
|
|
212
|
+
const attrs = (0, tactics_1.transformFromTactics)(withBlocking, 'team-1');
|
|
213
|
+
(0, globals_1.expect)(attrs.blocking_preferences).toEqual([
|
|
214
|
+
{ rotation: 1, targets: { [p4.id]: service_1.RoleEnum.OUTSIDE_HITTER, [p3.id]: service_1.RoleEnum.MIDDLE_BLOCKER } }
|
|
215
|
+
]);
|
|
216
|
+
const back = (0, tactics_1.transformToTactics)(attrs, roster);
|
|
217
|
+
(0, globals_1.expect)(back.blockingPreferences[0].targets).toEqual({ [p4.id]: service_1.RoleEnum.OUTSIDE_HITTER, [p3.id]: service_1.RoleEnum.MIDDLE_BLOCKER });
|
|
218
|
+
});
|
|
200
219
|
});
|
|
201
220
|
(0, globals_1.describe)('libero injuries — service <-> row round-trip + lenient heal', () => {
|
|
202
221
|
const country = (0, test_helpers_1.makeCountry)();
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Player } from '../player';
|
|
2
|
-
import { EnergyBand
|
|
2
|
+
import { EnergyBand } from './energy-band';
|
|
3
3
|
import { ConditionLogic, PinchCondition } from './pinch-condition';
|
|
4
4
|
export type SubBackMode = 'FATIGUE' | 'CONDITIONS';
|
|
5
5
|
export interface SetSubConfig {
|
|
6
|
-
readonly mode: SubMode;
|
|
7
6
|
readonly bench?: Player;
|
|
8
|
-
readonly fatigueBand?: EnergyBand;
|
|
9
|
-
readonly benchFatigueBand?: EnergyBand;
|
|
10
7
|
readonly conditions?: PinchCondition[];
|
|
11
8
|
readonly conditionLogic?: ConditionLogic;
|
|
12
9
|
readonly pinchServer?: boolean;
|
|
10
|
+
readonly benchFatigueBand?: EnergyBand;
|
|
13
11
|
readonly subBackMode?: SubBackMode;
|
|
14
12
|
readonly subBackConditions?: PinchCondition[];
|
|
15
13
|
readonly subBackConditionLogic?: ConditionLogic;
|
|
@@ -7,9 +7,11 @@ export * from './energy-band';
|
|
|
7
7
|
export * from './pinch-condition';
|
|
8
8
|
export * from './designated-sub';
|
|
9
9
|
export * from './libero-sub';
|
|
10
|
+
export * from './sub-config-convert';
|
|
10
11
|
export * from './rotation-system';
|
|
11
12
|
export * from './lineup-function';
|
|
12
13
|
export * from './base-position';
|
|
13
14
|
export * from './offensive-preference';
|
|
15
|
+
export * from './blocking-preference';
|
|
14
16
|
export * from './injury-replacement';
|
|
15
17
|
export * from './libero-injury';
|
|
@@ -23,9 +23,11 @@ __exportStar(require("./energy-band"), exports);
|
|
|
23
23
|
__exportStar(require("./pinch-condition"), exports);
|
|
24
24
|
__exportStar(require("./designated-sub"), exports);
|
|
25
25
|
__exportStar(require("./libero-sub"), exports);
|
|
26
|
+
__exportStar(require("./sub-config-convert"), exports);
|
|
26
27
|
__exportStar(require("./rotation-system"), exports);
|
|
27
28
|
__exportStar(require("./lineup-function"), exports);
|
|
28
29
|
__exportStar(require("./base-position"), exports);
|
|
29
30
|
__exportStar(require("./offensive-preference"), exports);
|
|
31
|
+
__exportStar(require("./blocking-preference"), exports);
|
|
30
32
|
__exportStar(require("./injury-replacement"), exports);
|
|
31
33
|
__exportStar(require("./libero-injury"), exports);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { EnergyBand } from './energy-band';
|
|
2
1
|
import { ConditionLogic, PinchCondition } from './pinch-condition';
|
|
3
|
-
export type LiberoSubMode = 'NEVER' | 'FATIGUE' | 'ALWAYS' | 'CONDITIONS';
|
|
4
2
|
export interface LiberoSetSubConfig {
|
|
5
|
-
readonly mode: LiberoSubMode;
|
|
6
|
-
readonly fatigueBand?: EnergyBand;
|
|
7
3
|
readonly conditions?: PinchCondition[];
|
|
8
4
|
readonly conditionLogic?: ConditionLogic;
|
|
9
5
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Player } from '../player';
|
|
2
1
|
export type TempoPreference = 'FAST' | 'HIGH';
|
|
3
2
|
export interface OffensivePreference {
|
|
4
3
|
readonly rotation: number;
|
|
5
|
-
readonly
|
|
4
|
+
readonly weights: Record<string, number>;
|
|
6
5
|
readonly tempos?: Record<string, TempoPreference>;
|
|
7
6
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { EnergyBand, SubBand } from './energy-band';
|
|
1
2
|
export declare enum PinchConditionType {
|
|
2
|
-
ASAP = "ASAP",//
|
|
3
|
+
ASAP = "ASAP",// unconditionally true (pinch server: every serve gain; libero rule: "Always")
|
|
3
4
|
TEAM_SET_POINT = "TEAM_SET_POINT",// team within `margin` of winning the set
|
|
4
5
|
OPPONENT_SET_POINT = "OPPONENT_SET_POINT",// opponent within `margin` of winning the set
|
|
5
6
|
SCORE_DIFF = "SCORE_DIFF",// team trailing/leading by at least `points`
|
|
@@ -7,7 +8,8 @@ export declare enum PinchConditionType {
|
|
|
7
8
|
FROM_SET = "FROM_SET",// only set N or later
|
|
8
9
|
MIN_OWN_SCORE = "MIN_OWN_SCORE",// only once own score >= N
|
|
9
10
|
MIN_OPPONENT_SCORE = "MIN_OPPONENT_SCORE",// only once opponent score >= N
|
|
10
|
-
PHASE = "PHASE"
|
|
11
|
+
PHASE = "PHASE",// the team is serving or receiving this rally (used by the libero deployment rule)
|
|
12
|
+
FATIGUE = "FATIGUE"
|
|
11
13
|
}
|
|
12
14
|
export declare enum MatchPhase {
|
|
13
15
|
SERVING = "SERVING",
|
|
@@ -66,7 +68,11 @@ export interface PhaseCondition {
|
|
|
66
68
|
readonly type: PinchConditionType.PHASE;
|
|
67
69
|
readonly phase: MatchPhase;
|
|
68
70
|
}
|
|
69
|
-
export
|
|
71
|
+
export interface FatigueCondition {
|
|
72
|
+
readonly type: PinchConditionType.FATIGUE;
|
|
73
|
+
readonly band?: EnergyBand;
|
|
74
|
+
}
|
|
75
|
+
export type PinchCondition = AsapCondition | TeamSetPointCondition | OpponentSetPointCondition | ScoreDiffCondition | AfterRotationsCondition | FromSetCondition | MinOwnScoreCondition | MinOpponentScoreCondition | PhaseCondition | FatigueCondition;
|
|
70
76
|
export type ConditionLogic = 'ALL' | 'ANY';
|
|
71
77
|
export interface PinchSetState {
|
|
72
78
|
readonly ownScore: number;
|
|
@@ -75,4 +81,6 @@ export interface PinchSetState {
|
|
|
75
81
|
readonly setNumber: number;
|
|
76
82
|
readonly ownServeTurns: number;
|
|
77
83
|
readonly phase: MatchPhase;
|
|
84
|
+
readonly subjectBand?: EnergyBand;
|
|
85
|
+
readonly defaultBand?: SubBand;
|
|
78
86
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Conditions that gate when a pinch server is forced in to serve (in for its linked starter when the team
|
|
3
|
-
// wins back the serve, out the moment the serve is lost). Each condition is evaluated against the live set
|
|
4
|
-
// state; a pinch entry combines them with ALL (every condition must hold) or ANY (one is enough).
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Comparison = exports.ScoreDirection = exports.OpponentRelation = exports.MatchPhase = exports.PinchConditionType = void 0;
|
|
4
|
+
// The ONE condition vocabulary of the substitution engine (owner 2026-07-11): designated substitutions,
|
|
5
|
+
// pinch servers, sub-backs, and the libero deployment rule all evaluate the same catalog against the live
|
|
6
|
+
// set state, combined with ALL (every condition must hold) or ANY (one is enough). A config with NO
|
|
7
|
+
// conditions never fires.
|
|
7
8
|
var PinchConditionType;
|
|
8
9
|
(function (PinchConditionType) {
|
|
9
10
|
PinchConditionType["ASAP"] = "ASAP";
|
|
@@ -14,7 +15,11 @@ var PinchConditionType;
|
|
|
14
15
|
PinchConditionType["FROM_SET"] = "FROM_SET";
|
|
15
16
|
PinchConditionType["MIN_OWN_SCORE"] = "MIN_OWN_SCORE";
|
|
16
17
|
PinchConditionType["MIN_OPPONENT_SCORE"] = "MIN_OPPONENT_SCORE";
|
|
17
|
-
PinchConditionType["PHASE"] = "PHASE";
|
|
18
|
+
PinchConditionType["PHASE"] = "PHASE";
|
|
19
|
+
// The SUBJECT player's energy is at-or-worse than `band` (absent band = the team `substitutionBand`). The
|
|
20
|
+
// subject comes from the evaluation context, never from the condition: sub-in conditions judge the STARTER
|
|
21
|
+
// on court, sub-back conditions judge the SUBSTITUTE on court, the libero rule judges the STARTING libero.
|
|
22
|
+
PinchConditionType["FATIGUE"] = "FATIGUE";
|
|
18
23
|
})(PinchConditionType || (exports.PinchConditionType = PinchConditionType = {}));
|
|
19
24
|
// Which side of the rally the team is on. Known at each dead ball: the serving team is SERVING, the other
|
|
20
25
|
// RECEIVING. Consumed by the PHASE condition (libero deployment); pinch servers always evaluate while SERVING.
|
|
@@ -34,26 +34,17 @@ export declare const PinchConditionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
34
34
|
}, z.core.$strip>, z.ZodObject<{
|
|
35
35
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
36
36
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
39
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
37
40
|
}, z.core.$strip>], "type">;
|
|
38
41
|
export declare const ConditionLogicSchema: z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>;
|
|
39
|
-
export declare const SubModeSchema: z.ZodEnum<{
|
|
40
|
-
NEVER: "NEVER";
|
|
41
|
-
FATIGUE: "FATIGUE";
|
|
42
|
-
PINCH: "PINCH";
|
|
43
|
-
}>;
|
|
44
42
|
export declare const SubBackModeSchema: z.ZodEnum<{
|
|
45
43
|
FATIGUE: "FATIGUE";
|
|
46
44
|
CONDITIONS: "CONDITIONS";
|
|
47
45
|
}>;
|
|
48
|
-
export declare const SetSubConfigSchema: z.ZodObject<{
|
|
49
|
-
mode: z.ZodEnum<{
|
|
50
|
-
NEVER: "NEVER";
|
|
51
|
-
FATIGUE: "FATIGUE";
|
|
52
|
-
PINCH: "PINCH";
|
|
53
|
-
}>;
|
|
46
|
+
export declare const SetSubConfigSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
54
47
|
bench: z.ZodOptional<z.ZodCustom<Player, Player>>;
|
|
55
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
56
|
-
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
57
48
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
49
|
type: z.ZodLiteral<PinchConditionType.ASAP>;
|
|
59
50
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -85,9 +76,13 @@ export declare const SetSubConfigSchema: z.ZodObject<{
|
|
|
85
76
|
}, z.core.$strip>, z.ZodObject<{
|
|
86
77
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
87
78
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
81
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
88
82
|
}, z.core.$strip>], "type">>>;
|
|
89
83
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
90
84
|
pinchServer: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
91
86
|
subBackMode: z.ZodOptional<z.ZodEnum<{
|
|
92
87
|
FATIGUE: "FATIGUE";
|
|
93
88
|
CONDITIONS: "CONDITIONS";
|
|
@@ -123,19 +118,15 @@ export declare const SetSubConfigSchema: z.ZodObject<{
|
|
|
123
118
|
}, z.core.$strip>, z.ZodObject<{
|
|
124
119
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
125
120
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
123
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
126
124
|
}, z.core.$strip>], "type">>>;
|
|
127
125
|
subBackConditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
128
|
-
}, z.core.$strip
|
|
129
|
-
export declare const DesignatedSubSchema: z.ZodObject<{
|
|
130
|
-
sets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
|
-
mode: z.ZodEnum<{
|
|
132
|
-
NEVER: "NEVER";
|
|
133
|
-
FATIGUE: "FATIGUE";
|
|
134
|
-
PINCH: "PINCH";
|
|
135
|
-
}>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
127
|
+
export declare const DesignatedSubSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
128
|
+
sets: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
136
129
|
bench: z.ZodOptional<z.ZodCustom<Player, Player>>;
|
|
137
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
138
|
-
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
139
130
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
131
|
type: z.ZodLiteral<PinchConditionType.ASAP>;
|
|
141
132
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -167,9 +158,13 @@ export declare const DesignatedSubSchema: z.ZodObject<{
|
|
|
167
158
|
}, z.core.$strip>, z.ZodObject<{
|
|
168
159
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
169
160
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
163
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
170
164
|
}, z.core.$strip>], "type">>>;
|
|
171
165
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
172
166
|
pinchServer: z.ZodOptional<z.ZodBoolean>;
|
|
167
|
+
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
173
168
|
subBackMode: z.ZodOptional<z.ZodEnum<{
|
|
174
169
|
FATIGUE: "FATIGUE";
|
|
175
170
|
CONDITIONS: "CONDITIONS";
|
|
@@ -205,17 +200,13 @@ export declare const DesignatedSubSchema: z.ZodObject<{
|
|
|
205
200
|
}, z.core.$strip>, z.ZodObject<{
|
|
206
201
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
207
202
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
203
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
205
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
208
206
|
}, z.core.$strip>], "type">>>;
|
|
209
207
|
subBackConditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
210
|
-
}, z.core.$strip
|
|
211
|
-
mode: z.ZodEnum<{
|
|
212
|
-
NEVER: "NEVER";
|
|
213
|
-
FATIGUE: "FATIGUE";
|
|
214
|
-
PINCH: "PINCH";
|
|
215
|
-
}>;
|
|
208
|
+
}, z.core.$strip>>>>;
|
|
216
209
|
bench: z.ZodOptional<z.ZodCustom<Player, Player>>;
|
|
217
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
218
|
-
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
219
210
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
220
211
|
type: z.ZodLiteral<PinchConditionType.ASAP>;
|
|
221
212
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -247,9 +238,13 @@ export declare const DesignatedSubSchema: z.ZodObject<{
|
|
|
247
238
|
}, z.core.$strip>, z.ZodObject<{
|
|
248
239
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
249
240
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
243
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
250
244
|
}, z.core.$strip>], "type">>>;
|
|
251
245
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
252
246
|
pinchServer: z.ZodOptional<z.ZodBoolean>;
|
|
247
|
+
benchFatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
253
248
|
subBackMode: z.ZodOptional<z.ZodEnum<{
|
|
254
249
|
FATIGUE: "FATIGUE";
|
|
255
250
|
CONDITIONS: "CONDITIONS";
|
|
@@ -285,7 +280,10 @@ export declare const DesignatedSubSchema: z.ZodObject<{
|
|
|
285
280
|
}, z.core.$strip>, z.ZodObject<{
|
|
286
281
|
type: z.ZodLiteral<PinchConditionType.PHASE>;
|
|
287
282
|
phase: z.ZodEnum<typeof MatchPhase>;
|
|
283
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
+
type: z.ZodLiteral<PinchConditionType.FATIGUE>;
|
|
285
|
+
band: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
288
286
|
}, z.core.$strip>], "type">>>;
|
|
289
287
|
subBackConditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
290
288
|
starter: z.ZodCustom<Player, Player>;
|
|
291
|
-
}, z.core.$strip
|
|
289
|
+
}, z.core.$strip>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DesignatedSubSchema = exports.SetSubConfigSchema = exports.SubBackModeSchema = exports.
|
|
3
|
+
exports.DesignatedSubSchema = exports.SetSubConfigSchema = exports.SubBackModeSchema = exports.ConditionLogicSchema = exports.PinchConditionSchema = exports.SubBandSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const player_1 = require("../../player");
|
|
6
6
|
const energy_band_1 = require("../energy-band");
|
|
7
7
|
const pinch_condition_1 = require("../pinch-condition");
|
|
8
|
+
const sub_config_convert_1 = require("../sub-config-convert");
|
|
8
9
|
const playerInstanceSchema = zod_1.z.custom((v) => v instanceof player_1.Player, {
|
|
9
10
|
message: 'INVALID_PLAYER_INSTANCE'
|
|
10
11
|
});
|
|
@@ -21,44 +22,47 @@ exports.PinchConditionSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
21
22
|
zod_1.z.object({ type: zod_1.z.literal(pinch_condition_1.PinchConditionType.MIN_OWN_SCORE), score: zod_1.z.number().int().min(0).max(40), comparison: zod_1.z.nativeEnum(pinch_condition_1.Comparison).optional() }),
|
|
22
23
|
zod_1.z.object({ type: zod_1.z.literal(pinch_condition_1.PinchConditionType.MIN_OPPONENT_SCORE), score: zod_1.z.number().int().min(0).max(40), comparison: zod_1.z.nativeEnum(pinch_condition_1.Comparison).optional() }),
|
|
23
24
|
// PHASE is used by the libero deployment rule (which reuses this schema); pinch servers never offer it.
|
|
24
|
-
zod_1.z.object({ type: zod_1.z.literal(pinch_condition_1.PinchConditionType.PHASE), phase: zod_1.z.nativeEnum(pinch_condition_1.MatchPhase) })
|
|
25
|
+
zod_1.z.object({ type: zod_1.z.literal(pinch_condition_1.PinchConditionType.PHASE), phase: zod_1.z.nativeEnum(pinch_condition_1.MatchPhase) }),
|
|
26
|
+
// The subject player's energy is at-or-worse than `band` (absent = the team `substitutionBand`); the
|
|
27
|
+
// subject comes from the evaluation context (starter / substitute / starting libero).
|
|
28
|
+
zod_1.z.object({ type: zod_1.z.literal(pinch_condition_1.PinchConditionType.FATIGUE), band: zod_1.z.nativeEnum(energy_band_1.EnergyBand).optional() })
|
|
25
29
|
]);
|
|
26
30
|
exports.ConditionLogicSchema = zod_1.z.union([zod_1.z.literal('ALL'), zod_1.z.literal('ANY')]);
|
|
27
|
-
exports.SubModeSchema = zod_1.z.enum(['FATIGUE', 'PINCH', 'NEVER']);
|
|
28
31
|
exports.SubBackModeSchema = zod_1.z.enum(['FATIGUE', 'CONDITIONS']);
|
|
29
|
-
// Fields shared by the all-sets config and each per-set config.
|
|
32
|
+
// Fields shared by the all-sets config and each per-set config. Pure condition engine (owner 2026-07-11):
|
|
33
|
+
// no mode; `conditions` is the sub-in trigger and an EMPTY/absent list means the starter is never substituted
|
|
34
|
+
// by this rule. Legacy mode-shaped inputs are auto-converted by the preprocess below.
|
|
30
35
|
const setSubConfigShape = {
|
|
31
|
-
mode: exports.SubModeSchema,
|
|
32
36
|
bench: playerInstanceSchema.optional(),
|
|
33
|
-
fatigueBand: zod_1.z.nativeEnum(energy_band_1.EnergyBand).optional(),
|
|
34
|
-
benchFatigueBand: zod_1.z.nativeEnum(energy_band_1.EnergyBand).optional(),
|
|
35
37
|
conditions: zod_1.z.array(exports.PinchConditionSchema).optional(),
|
|
36
38
|
conditionLogic: exports.ConditionLogicSchema.optional(),
|
|
37
|
-
//
|
|
39
|
+
// true = serve-and-return pinch server; false/absent = regular conditional sub (stays until sub-back).
|
|
38
40
|
pinchServer: zod_1.z.boolean().optional(),
|
|
39
|
-
//
|
|
41
|
+
// The substitute's own pull band for FATIGUE sub-backs (absent = the team `substitutionBand`).
|
|
42
|
+
benchFatigueBand: zod_1.z.nativeEnum(energy_band_1.EnergyBand).optional(),
|
|
40
43
|
subBackMode: exports.SubBackModeSchema.optional(),
|
|
41
44
|
subBackConditions: zod_1.z.array(exports.PinchConditionSchema).optional(),
|
|
42
45
|
subBackConditionLogic: exports.ConditionLogicSchema.optional()
|
|
43
46
|
};
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
// A pinch server needs a designated bench player and at least one sub-in condition. A regular conditional sub
|
|
48
|
+
// with a CONDITIONS sub-back needs at least one sub-back condition. Empty sub-in conditions are otherwise
|
|
49
|
+
// VALID (= never fires).
|
|
50
|
+
function refineSubConfig(data, ctx) {
|
|
51
|
+
if (data.pinchServer === true) {
|
|
52
|
+
if (data.bench == null) {
|
|
53
|
+
ctx.addIssue({ code: 'custom', message: 'PINCH_SERVER_REQUIRES_BENCH', path: ['bench'] });
|
|
54
|
+
}
|
|
55
|
+
if (data.conditions == null || data.conditions.length === 0) {
|
|
56
|
+
ctx.addIssue({ code: 'custom', message: 'PINCH_SERVER_REQUIRES_CONDITIONS', path: ['conditions'] });
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
if (data.pinchServer !== true && data.subBackMode === 'CONDITIONS' &&
|
|
56
60
|
(data.subBackConditions == null || data.subBackConditions.length === 0)) {
|
|
57
61
|
ctx.addIssue({ code: 'custom', message: 'CONDITIONAL_SUB_BACK_REQUIRES_CONDITIONS', path: ['subBackConditions'] });
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
|
-
exports.SetSubConfigSchema = zod_1.z.object(setSubConfigShape).superRefine(
|
|
61
|
-
exports.DesignatedSubSchema = zod_1.z.object({
|
|
64
|
+
exports.SetSubConfigSchema = zod_1.z.preprocess(sub_config_convert_1.convertLegacySetSubConfig, zod_1.z.object(setSubConfigShape).superRefine(refineSubConfig));
|
|
65
|
+
exports.DesignatedSubSchema = zod_1.z.preprocess(sub_config_convert_1.convertLegacyDesignatedSub, zod_1.z.object({
|
|
62
66
|
starter: playerInstanceSchema,
|
|
63
67
|
...setSubConfigShape,
|
|
64
68
|
// Optional per-set overrides (index 0 = set 1 ... index 4 = set 5); absent => the flat config for all sets.
|
|
@@ -67,5 +71,5 @@ exports.DesignatedSubSchema = zod_1.z.object({
|
|
|
67
71
|
// The flat config is the fallback for any set a partial `sets` array doesn't cover, so validate it whenever
|
|
68
72
|
// `sets` is absent or covers fewer than 5 sets (each present per-set config is validated by SetSubConfigSchema).
|
|
69
73
|
if (data.sets == null || data.sets.length < 5)
|
|
70
|
-
|
|
71
|
-
});
|
|
74
|
+
refineSubConfig(data, ctx);
|
|
75
|
+
}));
|
|
@@ -116,12 +116,14 @@ const test_helpers_1 = require("../../test-helpers");
|
|
|
116
116
|
});
|
|
117
117
|
(0, globals_1.expect)(res.success).toBe(true);
|
|
118
118
|
});
|
|
119
|
-
(0, globals_1.it)('
|
|
119
|
+
(0, globals_1.it)('heals an unknown legacy mode by stripping it (lenient conversion, config stays valid)', () => {
|
|
120
120
|
const res = designated_sub_z_1.DesignatedSubSchema.safeParse({
|
|
121
121
|
starter,
|
|
122
122
|
mode: 'SOMETIMES'
|
|
123
123
|
});
|
|
124
|
-
(0, globals_1.expect)(res.success).toBe(
|
|
124
|
+
(0, globals_1.expect)(res.success).toBe(true);
|
|
125
|
+
if (res.success)
|
|
126
|
+
(0, globals_1.expect)(res.data.mode).toBeUndefined();
|
|
125
127
|
});
|
|
126
128
|
(0, globals_1.it)('accepts a pinch-mode entry with a bench server and conditions', () => {
|
|
127
129
|
const res = designated_sub_z_1.DesignatedSubSchema.safeParse({
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export declare const LiberoSubModeSchema: z.ZodEnum<{
|
|
4
|
-
NEVER: "NEVER";
|
|
5
|
-
FATIGUE: "FATIGUE";
|
|
6
|
-
CONDITIONS: "CONDITIONS";
|
|
7
|
-
ALWAYS: "ALWAYS";
|
|
8
|
-
}>;
|
|
9
|
-
export declare const LiberoSetSubConfigSchema: z.ZodObject<{
|
|
10
|
-
mode: z.ZodEnum<{
|
|
11
|
-
NEVER: "NEVER";
|
|
12
|
-
FATIGUE: "FATIGUE";
|
|
13
|
-
CONDITIONS: "CONDITIONS";
|
|
14
|
-
ALWAYS: "ALWAYS";
|
|
15
|
-
}>;
|
|
16
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
2
|
+
export declare const LiberoSetSubConfigSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
17
3
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
4
|
type: z.ZodLiteral<import("..").PinchConditionType.ASAP>;
|
|
19
5
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -45,18 +31,14 @@ export declare const LiberoSetSubConfigSchema: z.ZodObject<{
|
|
|
45
31
|
}, z.core.$strip>, z.ZodObject<{
|
|
46
32
|
type: z.ZodLiteral<import("..").PinchConditionType.PHASE>;
|
|
47
33
|
phase: z.ZodEnum<typeof import("..").MatchPhase>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<import("..").PinchConditionType.FATIGUE>;
|
|
36
|
+
band: z.ZodOptional<z.ZodEnum<typeof import("..").EnergyBand>>;
|
|
48
37
|
}, z.core.$strip>], "type">>>;
|
|
49
38
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
50
|
-
}, z.core.$strip
|
|
51
|
-
export declare const LiberoSubConfigSchema: z.ZodObject<{
|
|
52
|
-
sets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53
|
-
mode: z.ZodEnum<{
|
|
54
|
-
NEVER: "NEVER";
|
|
55
|
-
FATIGUE: "FATIGUE";
|
|
56
|
-
CONDITIONS: "CONDITIONS";
|
|
57
|
-
ALWAYS: "ALWAYS";
|
|
58
|
-
}>;
|
|
59
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
export declare const LiberoSubConfigSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
41
|
+
sets: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
|
|
60
42
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
61
43
|
type: z.ZodLiteral<import("..").PinchConditionType.ASAP>;
|
|
62
44
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -88,16 +70,12 @@ export declare const LiberoSubConfigSchema: z.ZodObject<{
|
|
|
88
70
|
}, z.core.$strip>, z.ZodObject<{
|
|
89
71
|
type: z.ZodLiteral<import("..").PinchConditionType.PHASE>;
|
|
90
72
|
phase: z.ZodEnum<typeof import("..").MatchPhase>;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<import("..").PinchConditionType.FATIGUE>;
|
|
75
|
+
band: z.ZodOptional<z.ZodEnum<typeof import("..").EnergyBand>>;
|
|
91
76
|
}, z.core.$strip>], "type">>>;
|
|
92
77
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
93
|
-
}, z.core.$strip
|
|
94
|
-
mode: z.ZodEnum<{
|
|
95
|
-
NEVER: "NEVER";
|
|
96
|
-
FATIGUE: "FATIGUE";
|
|
97
|
-
CONDITIONS: "CONDITIONS";
|
|
98
|
-
ALWAYS: "ALWAYS";
|
|
99
|
-
}>;
|
|
100
|
-
fatigueBand: z.ZodOptional<z.ZodEnum<typeof EnergyBand>>;
|
|
78
|
+
}, z.core.$strip>>>>;
|
|
101
79
|
conditions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
102
80
|
type: z.ZodLiteral<import("..").PinchConditionType.ASAP>;
|
|
103
81
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -129,6 +107,9 @@ export declare const LiberoSubConfigSchema: z.ZodObject<{
|
|
|
129
107
|
}, z.core.$strip>, z.ZodObject<{
|
|
130
108
|
type: z.ZodLiteral<import("..").PinchConditionType.PHASE>;
|
|
131
109
|
phase: z.ZodEnum<typeof import("..").MatchPhase>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<import("..").PinchConditionType.FATIGUE>;
|
|
112
|
+
band: z.ZodOptional<z.ZodEnum<typeof import("..").EnergyBand>>;
|
|
132
113
|
}, z.core.$strip>], "type">>>;
|
|
133
114
|
conditionLogic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"ALL">, z.ZodLiteral<"ANY">]>>;
|
|
134
|
-
}, z.core.$strip
|
|
115
|
+
}, z.core.$strip>>;
|