tods-competition-factory 1.7.14 → 1.7.16
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/forge/generate.mjs +175 -142
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +2 -2
- package/dist/forge/query.mjs +10 -14
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +58 -73
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +212 -170
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +263 -218
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
function factoryVersion() {
|
|
336
|
-
return "1.7.
|
|
336
|
+
return "1.7.16";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -2561,31 +2561,25 @@ function validateTieFormat(params) {
|
|
|
2561
2561
|
if (!params || !tieFormat || typeof tieFormat !== "object") {
|
|
2562
2562
|
errors.push("tieFormat must be an object");
|
|
2563
2563
|
return decorateResult({
|
|
2564
|
-
result: {
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
stack
|
|
2568
|
-
}
|
|
2564
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
2565
|
+
context: { tieFormat, errors },
|
|
2566
|
+
stack
|
|
2569
2567
|
});
|
|
2570
2568
|
}
|
|
2571
2569
|
if (typeof tieFormat.winCriteria !== "object") {
|
|
2572
2570
|
errors.push("tieFormat.winCriteria must be an object");
|
|
2573
2571
|
return decorateResult({
|
|
2574
|
-
result: {
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
stack
|
|
2578
|
-
}
|
|
2572
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
2573
|
+
context: { tieFormat, errors },
|
|
2574
|
+
stack
|
|
2579
2575
|
});
|
|
2580
2576
|
}
|
|
2581
2577
|
if (!Array.isArray(tieFormat.collectionDefinitions)) {
|
|
2582
2578
|
errors.push(mustBeAnArray("tieFormat.collectionDefinitions"));
|
|
2583
2579
|
return decorateResult({
|
|
2584
|
-
result: {
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
stack
|
|
2588
|
-
}
|
|
2580
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
2581
|
+
context: { tieFormat, errors },
|
|
2582
|
+
stack
|
|
2589
2583
|
});
|
|
2590
2584
|
}
|
|
2591
2585
|
let aggregateValueImperative;
|
|
@@ -2618,11 +2612,9 @@ function validateTieFormat(params) {
|
|
|
2618
2612
|
);
|
|
2619
2613
|
}
|
|
2620
2614
|
return decorateResult({
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
stack
|
|
2625
|
-
}
|
|
2615
|
+
context: { tieFormat, errors, aggregateValueImperative },
|
|
2616
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
2617
|
+
stack
|
|
2626
2618
|
});
|
|
2627
2619
|
}
|
|
2628
2620
|
const collectionIds = tieFormat.collectionDefinitions.map(
|
|
@@ -2633,11 +2625,9 @@ function validateTieFormat(params) {
|
|
|
2633
2625
|
const result = { valid, errors };
|
|
2634
2626
|
if (!valid) {
|
|
2635
2627
|
return decorateResult({
|
|
2636
|
-
result: {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
stack
|
|
2640
|
-
}
|
|
2628
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
2629
|
+
context: { tieFormat, errors },
|
|
2630
|
+
stack
|
|
2641
2631
|
});
|
|
2642
2632
|
}
|
|
2643
2633
|
return result;
|
|
@@ -4814,19 +4804,15 @@ function findEvent({
|
|
|
4814
4804
|
}) {
|
|
4815
4805
|
const stack = "findEvent";
|
|
4816
4806
|
if (!tournamentRecord)
|
|
4817
|
-
return {
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
stack
|
|
4823
|
-
})
|
|
4824
|
-
};
|
|
4825
|
-
const events = tournamentRecord?.events || [];
|
|
4807
|
+
return decorateResult({
|
|
4808
|
+
result: { error: MISSING_TOURNAMENT_RECORD },
|
|
4809
|
+
stack
|
|
4810
|
+
});
|
|
4811
|
+
const events = tournamentRecord?.events ?? [];
|
|
4826
4812
|
if (drawId) {
|
|
4827
4813
|
let drawDefinition;
|
|
4828
4814
|
const event = events.find((event2) => {
|
|
4829
|
-
const drawDefinitions = event2?.drawDefinitions
|
|
4815
|
+
const drawDefinitions = event2?.drawDefinitions ?? [];
|
|
4830
4816
|
const targetDrawDefinition = drawDefinitions.find(
|
|
4831
4817
|
(drawDefinition2) => drawDefinition2.drawId === drawId
|
|
4832
4818
|
);
|
|
@@ -4905,7 +4891,7 @@ function addExtension$1(params) {
|
|
|
4905
4891
|
});
|
|
4906
4892
|
if (!params.element.extensions)
|
|
4907
4893
|
params.element.extensions = [];
|
|
4908
|
-
const creationTime = params
|
|
4894
|
+
const creationTime = params?.creationTime ?? true;
|
|
4909
4895
|
if (creationTime) {
|
|
4910
4896
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4911
4897
|
Object.assign(params.extension, { createdAt });
|
|
@@ -5456,7 +5442,7 @@ function findCourt({
|
|
|
5456
5442
|
} else if (tournamentRecords) {
|
|
5457
5443
|
const linkedTournamentIds = getLinkedTournamentIds({
|
|
5458
5444
|
tournamentRecords
|
|
5459
|
-
}).linkedTournamentIds
|
|
5445
|
+
}).linkedTournamentIds ?? [];
|
|
5460
5446
|
const relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
|
|
5461
5447
|
for (const tournamentId of relevantIds) {
|
|
5462
5448
|
const record = tournamentRecords[tournamentId];
|
|
@@ -13494,7 +13480,7 @@ const ratingsParameters = {
|
|
|
13494
13480
|
}
|
|
13495
13481
|
};
|
|
13496
13482
|
|
|
13497
|
-
var collectionDefinitions$
|
|
13483
|
+
var collectionDefinitions$i = [
|
|
13498
13484
|
{
|
|
13499
13485
|
collectionName: "Doubles",
|
|
13500
13486
|
matchUpCount: 3,
|
|
@@ -13510,17 +13496,17 @@ var collectionDefinitions$h = [
|
|
|
13510
13496
|
matchUpValue: 1
|
|
13511
13497
|
}
|
|
13512
13498
|
];
|
|
13513
|
-
var tieFormatName$
|
|
13514
|
-
var winCriteria$
|
|
13499
|
+
var tieFormatName$i = "COLLEGE_D3";
|
|
13500
|
+
var winCriteria$i = {
|
|
13515
13501
|
valueGoal: 5
|
|
13516
13502
|
};
|
|
13517
13503
|
var COLLEGE_D3$1 = {
|
|
13518
|
-
collectionDefinitions: collectionDefinitions$
|
|
13519
|
-
tieFormatName: tieFormatName$
|
|
13520
|
-
winCriteria: winCriteria$
|
|
13504
|
+
collectionDefinitions: collectionDefinitions$i,
|
|
13505
|
+
tieFormatName: tieFormatName$i,
|
|
13506
|
+
winCriteria: winCriteria$i
|
|
13521
13507
|
};
|
|
13522
13508
|
|
|
13523
|
-
var collectionDefinitions$
|
|
13509
|
+
var collectionDefinitions$h = [
|
|
13524
13510
|
{
|
|
13525
13511
|
collectionName: "Doubles",
|
|
13526
13512
|
collectionValue: 1,
|
|
@@ -13536,17 +13522,17 @@ var collectionDefinitions$g = [
|
|
|
13536
13522
|
matchUpValue: 1
|
|
13537
13523
|
}
|
|
13538
13524
|
];
|
|
13539
|
-
var tieFormatName$
|
|
13540
|
-
var winCriteria$
|
|
13525
|
+
var tieFormatName$h = "COLLEGE_DEFAULT";
|
|
13526
|
+
var winCriteria$h = {
|
|
13541
13527
|
valueGoal: 5
|
|
13542
13528
|
};
|
|
13543
13529
|
var COLLEGE_DEFAULT$1 = {
|
|
13544
|
-
collectionDefinitions: collectionDefinitions$
|
|
13545
|
-
tieFormatName: tieFormatName$
|
|
13546
|
-
winCriteria: winCriteria$
|
|
13530
|
+
collectionDefinitions: collectionDefinitions$h,
|
|
13531
|
+
tieFormatName: tieFormatName$h,
|
|
13532
|
+
winCriteria: winCriteria$h
|
|
13547
13533
|
};
|
|
13548
13534
|
|
|
13549
|
-
var collectionDefinitions$
|
|
13535
|
+
var collectionDefinitions$g = [
|
|
13550
13536
|
{
|
|
13551
13537
|
collectionName: "Doubles",
|
|
13552
13538
|
matchUpCount: 3,
|
|
@@ -13562,17 +13548,17 @@ var collectionDefinitions$f = [
|
|
|
13562
13548
|
matchUpValue: 1
|
|
13563
13549
|
}
|
|
13564
13550
|
];
|
|
13565
|
-
var tieFormatName$
|
|
13566
|
-
var winCriteria$
|
|
13551
|
+
var tieFormatName$g = "COLLEGE_JUCO";
|
|
13552
|
+
var winCriteria$g = {
|
|
13567
13553
|
valueGoal: 5
|
|
13568
13554
|
};
|
|
13569
13555
|
var COLLEGE_JUCO$1 = {
|
|
13570
|
-
collectionDefinitions: collectionDefinitions$
|
|
13571
|
-
tieFormatName: tieFormatName$
|
|
13572
|
-
winCriteria: winCriteria$
|
|
13556
|
+
collectionDefinitions: collectionDefinitions$g,
|
|
13557
|
+
tieFormatName: tieFormatName$g,
|
|
13558
|
+
winCriteria: winCriteria$g
|
|
13573
13559
|
};
|
|
13574
13560
|
|
|
13575
|
-
var collectionDefinitions$
|
|
13561
|
+
var collectionDefinitions$f = [
|
|
13576
13562
|
{
|
|
13577
13563
|
collectionName: "Doubles",
|
|
13578
13564
|
matchUpCount: 1,
|
|
@@ -13588,17 +13574,17 @@ var collectionDefinitions$e = [
|
|
|
13588
13574
|
matchUpValue: 1
|
|
13589
13575
|
}
|
|
13590
13576
|
];
|
|
13591
|
-
var tieFormatName$
|
|
13592
|
-
var winCriteria$
|
|
13577
|
+
var tieFormatName$f = "DOMINANT_DUO";
|
|
13578
|
+
var winCriteria$f = {
|
|
13593
13579
|
valueGoal: 2
|
|
13594
13580
|
};
|
|
13595
13581
|
var DOMINANT_DUO_TIE_FORMAT = {
|
|
13596
|
-
collectionDefinitions: collectionDefinitions$
|
|
13597
|
-
tieFormatName: tieFormatName$
|
|
13598
|
-
winCriteria: winCriteria$
|
|
13582
|
+
collectionDefinitions: collectionDefinitions$f,
|
|
13583
|
+
tieFormatName: tieFormatName$f,
|
|
13584
|
+
winCriteria: winCriteria$f
|
|
13599
13585
|
};
|
|
13600
13586
|
|
|
13601
|
-
var collectionDefinitions$
|
|
13587
|
+
var collectionDefinitions$e = [
|
|
13602
13588
|
{
|
|
13603
13589
|
collectionName: "Mixed Doubles",
|
|
13604
13590
|
gender: "MIXED",
|
|
@@ -13624,17 +13610,17 @@ var collectionDefinitions$d = [
|
|
|
13624
13610
|
matchUpValue: 1
|
|
13625
13611
|
}
|
|
13626
13612
|
];
|
|
13627
|
-
var tieFormatName$
|
|
13628
|
-
var winCriteria$
|
|
13613
|
+
var tieFormatName$e = "DOMINANT_DUO_MIXED";
|
|
13614
|
+
var winCriteria$e = {
|
|
13629
13615
|
valueGoal: 2
|
|
13630
13616
|
};
|
|
13631
13617
|
var DOMINANT_DUO_MIXED_TIE_FORMAT = {
|
|
13632
|
-
collectionDefinitions: collectionDefinitions$
|
|
13633
|
-
tieFormatName: tieFormatName$
|
|
13634
|
-
winCriteria: winCriteria$
|
|
13618
|
+
collectionDefinitions: collectionDefinitions$e,
|
|
13619
|
+
tieFormatName: tieFormatName$e,
|
|
13620
|
+
winCriteria: winCriteria$e
|
|
13635
13621
|
};
|
|
13636
13622
|
|
|
13637
|
-
var collectionDefinitions$
|
|
13623
|
+
var collectionDefinitions$d = [
|
|
13638
13624
|
{
|
|
13639
13625
|
collectionGroupNumber: 1,
|
|
13640
13626
|
matchUpType: "DOUBLES",
|
|
@@ -13692,18 +13678,18 @@ var collectionGroups$1 = [
|
|
|
13692
13678
|
groupName: "Day 3"
|
|
13693
13679
|
}
|
|
13694
13680
|
];
|
|
13695
|
-
var tieFormatName$
|
|
13696
|
-
var winCriteria$
|
|
13681
|
+
var tieFormatName$d = "LAVER_CUP";
|
|
13682
|
+
var winCriteria$d = {
|
|
13697
13683
|
valueGoal: 13
|
|
13698
13684
|
};
|
|
13699
13685
|
var LAVER_CUP_TIE_FORMAT = {
|
|
13700
|
-
collectionDefinitions: collectionDefinitions$
|
|
13686
|
+
collectionDefinitions: collectionDefinitions$d,
|
|
13701
13687
|
collectionGroups: collectionGroups$1,
|
|
13702
|
-
tieFormatName: tieFormatName$
|
|
13703
|
-
winCriteria: winCriteria$
|
|
13688
|
+
tieFormatName: tieFormatName$d,
|
|
13689
|
+
winCriteria: winCriteria$d
|
|
13704
13690
|
};
|
|
13705
13691
|
|
|
13706
|
-
var collectionDefinitions$
|
|
13692
|
+
var collectionDefinitions$c = [
|
|
13707
13693
|
{
|
|
13708
13694
|
collectionName: "Round 1",
|
|
13709
13695
|
matchUpCount: 3,
|
|
@@ -13726,15 +13712,67 @@ var collectionDefinitions$b = [
|
|
|
13726
13712
|
scoreValue: 1
|
|
13727
13713
|
}
|
|
13728
13714
|
];
|
|
13729
|
-
var tieFormatName$
|
|
13715
|
+
var tieFormatName$c = "Doubles Shuffle";
|
|
13730
13716
|
var unrestrictedSelections = true;
|
|
13731
|
-
var winCriteria$
|
|
13717
|
+
var winCriteria$c = {
|
|
13732
13718
|
aggregateValue: true
|
|
13733
13719
|
};
|
|
13734
13720
|
var TEAM_AGGREGATION_TIE_FORMAT = {
|
|
13721
|
+
collectionDefinitions: collectionDefinitions$c,
|
|
13722
|
+
tieFormatName: tieFormatName$c,
|
|
13723
|
+
unrestrictedSelections: unrestrictedSelections,
|
|
13724
|
+
winCriteria: winCriteria$c
|
|
13725
|
+
};
|
|
13726
|
+
|
|
13727
|
+
var collectionDefinitions$b = [
|
|
13728
|
+
{
|
|
13729
|
+
scoreValue: 1,
|
|
13730
|
+
matchUpType: "SINGLES",
|
|
13731
|
+
collectionName: "Men's Singles",
|
|
13732
|
+
matchUpFormat: "SET1-S:T60",
|
|
13733
|
+
gender: "MALE",
|
|
13734
|
+
matchUpCount: 3
|
|
13735
|
+
},
|
|
13736
|
+
{
|
|
13737
|
+
scoreValue: 1,
|
|
13738
|
+
matchUpType: "SINGLES",
|
|
13739
|
+
collectionName: "Women's Singles",
|
|
13740
|
+
matchUpFormat: "SET1-S:T60",
|
|
13741
|
+
gender: "FEMALE",
|
|
13742
|
+
matchUpCount: 3
|
|
13743
|
+
},
|
|
13744
|
+
{
|
|
13745
|
+
scoreValue: 1,
|
|
13746
|
+
matchUpType: "DOUBLES",
|
|
13747
|
+
collectionName: "Men's Doubles",
|
|
13748
|
+
matchUpFormat: "SET1-S:T60",
|
|
13749
|
+
gender: "MALE",
|
|
13750
|
+
matchUpCount: 1
|
|
13751
|
+
},
|
|
13752
|
+
{
|
|
13753
|
+
matchUpValue: 1,
|
|
13754
|
+
matchUpType: "DOUBLES",
|
|
13755
|
+
collectionName: "Women's Doubles",
|
|
13756
|
+
matchUpFormat: "SET1-S:T60",
|
|
13757
|
+
gender: "FEMALE",
|
|
13758
|
+
matchUpCount: 1
|
|
13759
|
+
},
|
|
13760
|
+
{
|
|
13761
|
+
matchUpValue: 1,
|
|
13762
|
+
matchUpType: "DOUBLES",
|
|
13763
|
+
collectionName: "Mixed Doubles",
|
|
13764
|
+
matchUpFormat: "SET1-S:T60",
|
|
13765
|
+
gender: "MIXED",
|
|
13766
|
+
matchUpCount: 1
|
|
13767
|
+
}
|
|
13768
|
+
];
|
|
13769
|
+
var tieFormatName$b = "Time Tennis";
|
|
13770
|
+
var winCriteria$b = {
|
|
13771
|
+
aggregateValue: true
|
|
13772
|
+
};
|
|
13773
|
+
var TIME_TENNIS_TIE_FORMAT = {
|
|
13735
13774
|
collectionDefinitions: collectionDefinitions$b,
|
|
13736
13775
|
tieFormatName: tieFormatName$b,
|
|
13737
|
-
unrestrictedSelections: unrestrictedSelections,
|
|
13738
13776
|
winCriteria: winCriteria$b
|
|
13739
13777
|
};
|
|
13740
13778
|
|
|
@@ -14512,6 +14550,7 @@ const tieFormats = {
|
|
|
14512
14550
|
DOMINANT_DUO_MIXED: DOMINANT_DUO_MIXED_TIE_FORMAT,
|
|
14513
14551
|
LAVER_CUP: LAVER_CUP_TIE_FORMAT,
|
|
14514
14552
|
TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT,
|
|
14553
|
+
TIME_TENNIS: TIME_TENNIS_TIE_FORMAT,
|
|
14515
14554
|
USTA_BREWER_CUP: USTA_BREWER_CUP_TIE_FORMAT,
|
|
14516
14555
|
USTA_OZAKI_CUP: USTA_OZAKI_CUP_TIE_FORMAT,
|
|
14517
14556
|
USTA_COLLEGE: USTA_COLLEGE_TIE_FORMAT,
|
|
@@ -20808,7 +20847,7 @@ function removeSubsequentRoundsParticipant({
|
|
|
20808
20847
|
const positionAssignments = getPositionAssignments$1({
|
|
20809
20848
|
drawDefinition,
|
|
20810
20849
|
structureId
|
|
20811
|
-
}).positionAssignments
|
|
20850
|
+
}).positionAssignments ?? [];
|
|
20812
20851
|
relevantMatchUps?.forEach(
|
|
20813
20852
|
(matchUp) => removeDrawPosition({
|
|
20814
20853
|
drawPosition: targetDrawPosition,
|
|
@@ -20838,7 +20877,7 @@ function removeDrawPosition({
|
|
|
20838
20877
|
const initialDrawPositions = targetMatchUp.drawPositions?.slice();
|
|
20839
20878
|
const initialMatchUpStatus = targetMatchUp.matchUpStatus;
|
|
20840
20879
|
const initialWinningSide = targetMatchUp.winningSide;
|
|
20841
|
-
matchUpsMap = matchUpsMap
|
|
20880
|
+
matchUpsMap = matchUpsMap ?? getMatchUpsMap({ drawDefinition });
|
|
20842
20881
|
const mappedMatchUps = matchUpsMap.mappedMatchUps;
|
|
20843
20882
|
const matchUps = mappedMatchUps[structure.structureId].matchUps;
|
|
20844
20883
|
const { initialRoundNumber } = getInitialRoundNumber({
|
|
@@ -20846,7 +20885,7 @@ function removeDrawPosition({
|
|
|
20846
20885
|
matchUps
|
|
20847
20886
|
});
|
|
20848
20887
|
if (targetMatchUp.roundNumber && initialRoundNumber && targetMatchUp.roundNumber > initialRoundNumber) {
|
|
20849
|
-
const drawPositions = (targetMatchUp.drawPositions
|
|
20888
|
+
const drawPositions = (targetMatchUp.drawPositions ?? []).map(
|
|
20850
20889
|
(currentDrawPosition) => currentDrawPosition === drawPosition ? void 0 : currentDrawPosition
|
|
20851
20890
|
);
|
|
20852
20891
|
targetMatchUp.drawPositions = drawPositions;
|
|
@@ -20855,7 +20894,7 @@ function removeDrawPosition({
|
|
|
20855
20894
|
const inContextTargetMatchUp = inContextDrawMatchUps?.find(
|
|
20856
20895
|
(matchUp) => matchUp.matchUpId === targetMatchUp.matchUpId
|
|
20857
20896
|
);
|
|
20858
|
-
const sides = inContextTargetMatchUp?.sides
|
|
20897
|
+
const sides = inContextTargetMatchUp?.sides ?? [];
|
|
20859
20898
|
const drawPositionSideIndex = sides.reduce(
|
|
20860
20899
|
(index, side, i) => side.drawPosition === drawPosition ? i : index,
|
|
20861
20900
|
void 0
|
|
@@ -22074,9 +22113,7 @@ function assignMatchUpDrawPosition({
|
|
|
22074
22113
|
return { ...SUCCESS };
|
|
22075
22114
|
} else {
|
|
22076
22115
|
return decorateResult({
|
|
22077
|
-
result: {
|
|
22078
|
-
error: DRAW_POSITION_ASSIGNED
|
|
22079
|
-
},
|
|
22116
|
+
result: { error: DRAW_POSITION_ASSIGNED },
|
|
22080
22117
|
context: { drawPosition },
|
|
22081
22118
|
stack
|
|
22082
22119
|
});
|
|
@@ -23153,8 +23190,8 @@ function getSeedGroups({
|
|
|
23153
23190
|
return {
|
|
23154
23191
|
seedGroups: void 0,
|
|
23155
23192
|
...decorateResult({
|
|
23156
|
-
result: { error: INVALID_VALUES },
|
|
23157
23193
|
context: { roundRobinGroupsCount },
|
|
23194
|
+
result: { error: INVALID_VALUES },
|
|
23158
23195
|
stack
|
|
23159
23196
|
})
|
|
23160
23197
|
};
|
|
@@ -23198,8 +23235,8 @@ function getSeedingThresholds({
|
|
|
23198
23235
|
const invalid = !validGroupsCounts?.includes(roundRobinGroupsCount);
|
|
23199
23236
|
if (invalid) {
|
|
23200
23237
|
return decorateResult({
|
|
23201
|
-
|
|
23202
|
-
|
|
23238
|
+
context: { roundRobinGroupsCount },
|
|
23239
|
+
result: { error: INVALID_VALUES }
|
|
23203
23240
|
});
|
|
23204
23241
|
}
|
|
23205
23242
|
}
|
|
@@ -24306,7 +24343,8 @@ function directLoser(params) {
|
|
|
24306
24343
|
if (result.error)
|
|
24307
24344
|
return decorateResult({ result, stack });
|
|
24308
24345
|
} else if (loserParticipantId && isFeedRound) {
|
|
24309
|
-
|
|
24346
|
+
unfilledTargetMatchUpDrawPositions.sort(numericSort);
|
|
24347
|
+
const fedDrawPosition = unfilledTargetMatchUpDrawPositions[0];
|
|
24310
24348
|
const result = assignDrawPosition$1({
|
|
24311
24349
|
participantId: loserParticipantId,
|
|
24312
24350
|
structureId: targetStructureId,
|
|
@@ -25293,7 +25331,7 @@ function setMatchUpStatus$2(params) {
|
|
|
25293
25331
|
drawDefinition
|
|
25294
25332
|
});
|
|
25295
25333
|
if (score && matchUp.matchUpType !== TEAM$2 && !disableScoreValidation) {
|
|
25296
|
-
const matchUpFormat = matchUp.matchUpFormat
|
|
25334
|
+
const matchUpFormat = matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
25297
25335
|
const result2 = validateScore({
|
|
25298
25336
|
existingMatchUpStatus: matchUp.matchUpStatus,
|
|
25299
25337
|
matchUpFormat,
|
|
@@ -25314,9 +25352,9 @@ function setMatchUpStatus$2(params) {
|
|
|
25314
25352
|
).every((assignment) => assignment.participantId);
|
|
25315
25353
|
if (matchUpStatus && particicipantsRequiredMatchUpStatuses.includes(matchUpStatus) && !bothSideParticipants) {
|
|
25316
25354
|
return decorateResult({
|
|
25317
|
-
result: { error: INVALID_MATCHUP_STATUS },
|
|
25318
25355
|
info: "present in participantRequiredMatchUpStatuses",
|
|
25319
|
-
context: { matchUpStatus, bothSideParticipants }
|
|
25356
|
+
context: { matchUpStatus, bothSideParticipants },
|
|
25357
|
+
result: { error: INVALID_MATCHUP_STATUS }
|
|
25320
25358
|
});
|
|
25321
25359
|
}
|
|
25322
25360
|
const appliedPolicies = getAppliedPolicies({
|
|
@@ -25439,8 +25477,8 @@ function winningSideWithDownstreamDependencies(params) {
|
|
|
25439
25477
|
return applyMatchUpValues(params);
|
|
25440
25478
|
} else {
|
|
25441
25479
|
return decorateResult({
|
|
25442
|
-
result: { error: CANNOT_CHANGE_WINNING_SIDE },
|
|
25443
25480
|
stack: "winningSideWithDownstreamDependencies",
|
|
25481
|
+
result: { error: CANNOT_CHANGE_WINNING_SIDE },
|
|
25444
25482
|
context: { winningSide, matchUp }
|
|
25445
25483
|
});
|
|
25446
25484
|
}
|
|
@@ -25844,14 +25882,14 @@ function addDrawDefinition$1(params) {
|
|
|
25844
25882
|
if (relevantFlight && !drawEntriesPresentInFlight) {
|
|
25845
25883
|
return decorateResult({
|
|
25846
25884
|
result: {
|
|
25847
|
-
error: INVALID_DRAW_DEFINITION
|
|
25848
|
-
|
|
25849
|
-
|
|
25850
|
-
|
|
25851
|
-
|
|
25852
|
-
|
|
25853
|
-
|
|
25854
|
-
|
|
25885
|
+
error: INVALID_DRAW_DEFINITION
|
|
25886
|
+
},
|
|
25887
|
+
context: {
|
|
25888
|
+
drawEntriesPresentInFlight,
|
|
25889
|
+
matchingEventEntries,
|
|
25890
|
+
relevantFlight
|
|
25891
|
+
},
|
|
25892
|
+
info: "Draw entries are not present in flight or do not match entryStatuses"
|
|
25855
25893
|
});
|
|
25856
25894
|
}
|
|
25857
25895
|
if (modifyEventEntries) {
|
|
@@ -25870,9 +25908,9 @@ function addDrawDefinition$1(params) {
|
|
|
25870
25908
|
if (eventEntries && !matchingEventEntries)
|
|
25871
25909
|
return decorateResult({
|
|
25872
25910
|
result: {
|
|
25873
|
-
|
|
25911
|
+
info: "Draw entries do not match event entryStatuses",
|
|
25874
25912
|
context: { matchingEventEntries, eventEntries },
|
|
25875
|
-
|
|
25913
|
+
error: INVALID_DRAW_DEFINITION
|
|
25876
25914
|
}
|
|
25877
25915
|
});
|
|
25878
25916
|
const flightNumbers = flightProfile?.flights?.map(
|
|
@@ -26051,10 +26089,8 @@ function addParticipant$1({
|
|
|
26051
26089
|
});
|
|
26052
26090
|
} else if (participant.individualParticipantIds.length !== 2 && !pairOverride) {
|
|
26053
26091
|
return decorateResult({
|
|
26054
|
-
|
|
26055
|
-
|
|
26056
|
-
info: "PAIR must be 2 individualParticipantIds"
|
|
26057
|
-
},
|
|
26092
|
+
info: "PAIR must be 2 individualParticipantIds",
|
|
26093
|
+
result: { error: INVALID_PARTICIPANT_IDS },
|
|
26058
26094
|
stack
|
|
26059
26095
|
});
|
|
26060
26096
|
} else {
|
|
@@ -29806,7 +29842,8 @@ function updateTieFormat({
|
|
|
29806
29842
|
} else {
|
|
29807
29843
|
return decorateResult({
|
|
29808
29844
|
result: { error: CANNOT_MODIFY_TIEFORMAT },
|
|
29809
|
-
info: "matchUp is IN_PROGRESS or COMPLETE"
|
|
29845
|
+
info: "matchUp is IN_PROGRESS or COMPLETE",
|
|
29846
|
+
stack
|
|
29810
29847
|
});
|
|
29811
29848
|
}
|
|
29812
29849
|
} else if (changesArePossible) {
|
|
@@ -30674,6 +30711,7 @@ function addCollectionDefinition$1({
|
|
|
30674
30711
|
uuids,
|
|
30675
30712
|
event
|
|
30676
30713
|
}) {
|
|
30714
|
+
const stack = "addCollectionDefinition";
|
|
30677
30715
|
const appliedPolicies = getAppliedPolicies({
|
|
30678
30716
|
tournamentRecord,
|
|
30679
30717
|
drawDefinition,
|
|
@@ -30687,10 +30725,10 @@ function addCollectionDefinition$1({
|
|
|
30687
30725
|
checkGender,
|
|
30688
30726
|
event
|
|
30689
30727
|
});
|
|
30690
|
-
if (!valid)
|
|
30691
|
-
return { error: INVALID_VALUES, errors };
|
|
30692
|
-
|
|
30693
|
-
let result = !matchUp ? getTieFormat$1({
|
|
30728
|
+
if (!valid) {
|
|
30729
|
+
return decorateResult({ result: { error: INVALID_VALUES, errors }, stack });
|
|
30730
|
+
}
|
|
30731
|
+
let result = !matchUp?.tieFormat ? getTieFormat$1({
|
|
30694
30732
|
drawDefinition,
|
|
30695
30733
|
structureId,
|
|
30696
30734
|
matchUpId,
|
|
@@ -30698,14 +30736,15 @@ function addCollectionDefinition$1({
|
|
|
30698
30736
|
event
|
|
30699
30737
|
}) : void 0;
|
|
30700
30738
|
if (result?.error)
|
|
30701
|
-
return { error: result.error };
|
|
30739
|
+
return decorateResult({ result: { error: result.error }, stack });
|
|
30702
30740
|
const structure = result?.structure;
|
|
30703
30741
|
matchUp = matchUp ?? result?.matchUp;
|
|
30704
|
-
const existingTieFormat = result?.tieFormat;
|
|
30742
|
+
const existingTieFormat = matchUp?.tieFormat ?? result?.tieFormat;
|
|
30705
30743
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
30706
30744
|
result = validateTieFormat({ tieFormat });
|
|
30707
|
-
if (result?.error)
|
|
30708
|
-
return { error: result.error };
|
|
30745
|
+
if (result?.error) {
|
|
30746
|
+
return decorateResult({ result: { error: result.error }, stack });
|
|
30747
|
+
}
|
|
30709
30748
|
if (!collectionDefinition.collectionId) {
|
|
30710
30749
|
collectionDefinition.collectionId = UUID();
|
|
30711
30750
|
} else {
|
|
@@ -30738,8 +30777,9 @@ function addCollectionDefinition$1({
|
|
|
30738
30777
|
let targetMatchUps = [];
|
|
30739
30778
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
30740
30779
|
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
30741
|
-
if (result?.error)
|
|
30742
|
-
return { error: result.error };
|
|
30780
|
+
if (result?.error) {
|
|
30781
|
+
return decorateResult({ result: { error: result.error }, stack });
|
|
30782
|
+
}
|
|
30743
30783
|
if (eventId && event) {
|
|
30744
30784
|
event.tieFormat = prunedTieFormat;
|
|
30745
30785
|
for (const drawDefinition2 of event.drawDefinitions ?? []) {
|
|
@@ -31168,10 +31208,8 @@ function addCollectionGroup$1({
|
|
|
31168
31208
|
const { collectionId, collectionGroupNumber: collectionGroupNumber2 } = collectionDefinition;
|
|
31169
31209
|
if (collectionGroupNumber2 && collectionIds.includes(collectionId))
|
|
31170
31210
|
return decorateResult({
|
|
31171
|
-
|
|
31172
|
-
|
|
31173
|
-
info: "collectionIds cannot be part of other collectionGroups"
|
|
31174
|
-
},
|
|
31211
|
+
info: "collectionIds cannot be part of other collectionGroups",
|
|
31212
|
+
result: { error: INVALID_VALUES },
|
|
31175
31213
|
stack
|
|
31176
31214
|
});
|
|
31177
31215
|
}
|
|
@@ -31226,7 +31264,7 @@ function modifyTieFormat$1({
|
|
|
31226
31264
|
uuids,
|
|
31227
31265
|
event
|
|
31228
31266
|
}) {
|
|
31229
|
-
const stack = "
|
|
31267
|
+
const stack = "modifyTieFormat";
|
|
31230
31268
|
if (!validateTieFormat({ tieFormat: modifiedTieFormat }).valid) {
|
|
31231
31269
|
return decorateResult({
|
|
31232
31270
|
result: { error: INVALID_TIE_FORMAT },
|
|
@@ -31252,11 +31290,16 @@ function modifyTieFormat$1({
|
|
|
31252
31290
|
if (comparison.invalid) {
|
|
31253
31291
|
return decorateResult({
|
|
31254
31292
|
context: { invalid: comparison.invalid },
|
|
31255
|
-
result: { error: INVALID_TIE_FORMAT }
|
|
31293
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
31294
|
+
stack
|
|
31256
31295
|
});
|
|
31257
31296
|
}
|
|
31258
31297
|
if (!comparison?.different) {
|
|
31259
|
-
return decorateResult({
|
|
31298
|
+
return decorateResult({
|
|
31299
|
+
result: { ...SUCCESS },
|
|
31300
|
+
info: "Nothing to do",
|
|
31301
|
+
stack
|
|
31302
|
+
});
|
|
31260
31303
|
}
|
|
31261
31304
|
const existingCollectionIds = tieFormat.collectionDefinitions.map(
|
|
31262
31305
|
({ collectionId }) => collectionId
|
|
@@ -37092,7 +37135,7 @@ function matchUpActions$2({
|
|
|
37092
37135
|
const availableIndividualParticipants = inContextDualMatchUp?.sides?.map(
|
|
37093
37136
|
(side2) => side2.participant.individualParticipants.filter(
|
|
37094
37137
|
({ participantId: participantId2, person }) => !existingParticipantIds?.includes(participantId2) && (!gender || gender === ANY || person.sex === gender || // case where one gendered member has been assigned
|
|
37095
|
-
gender === MIXED && assignedGender && person.sex !== assignedGender)
|
|
37138
|
+
gender === MIXED && !assignedGender || assignedGender && person.sex !== assignedGender)
|
|
37096
37139
|
)
|
|
37097
37140
|
);
|
|
37098
37141
|
const availableParticipants = sideNumber ? availableIndividualParticipants?.[sideNumber - 1] : availableIndividualParticipants?.map((available2, i) => ({
|
|
@@ -42828,11 +42871,7 @@ function positionByes({
|
|
|
42828
42871
|
}
|
|
42829
42872
|
|
|
42830
42873
|
function positionQualifiers(params) {
|
|
42831
|
-
|
|
42832
|
-
if (!structure)
|
|
42833
|
-
({ structure } = findStructure(params));
|
|
42834
|
-
if (!structureId)
|
|
42835
|
-
({ structureId } = structure);
|
|
42874
|
+
const structure = params.structure ?? findStructure(params).structure;
|
|
42836
42875
|
const stack = "positionQualifiers";
|
|
42837
42876
|
const qualifierDrawPositions = [];
|
|
42838
42877
|
if (structure.stage === CONSOLATION) {
|
|
@@ -43476,7 +43515,7 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
43476
43515
|
drawDefinition
|
|
43477
43516
|
});
|
|
43478
43517
|
if (!structure)
|
|
43479
|
-
return decorateResult({ result: { error: STRUCTURE_NOT_FOUND } });
|
|
43518
|
+
return decorateResult({ result: { error: STRUCTURE_NOT_FOUND }, stack });
|
|
43480
43519
|
if (structure.structureType === CONTAINER || structure.structures) {
|
|
43481
43520
|
return generateAndPopulateRRplayoffStructures({
|
|
43482
43521
|
sourceStructureId: structure.structureId,
|
|
@@ -44290,11 +44329,11 @@ function attachStructures$1({
|
|
|
44290
44329
|
links = [],
|
|
44291
44330
|
event
|
|
44292
44331
|
}) {
|
|
44332
|
+
const stack = "attachStructures";
|
|
44293
44333
|
if (!drawDefinition)
|
|
44294
44334
|
return { error: MISSING_DRAW_DEFINITION };
|
|
44295
44335
|
if (!Array.isArray(structures) || !Array.isArray(links))
|
|
44296
|
-
return decorateResult({ result: { error: INVALID_VALUES } });
|
|
44297
|
-
const stack = "attachStructures";
|
|
44336
|
+
return decorateResult({ result: { error: INVALID_VALUES }, stack });
|
|
44298
44337
|
const linkHash = (link) => [
|
|
44299
44338
|
link.source.structureId,
|
|
44300
44339
|
link.source.roundNumber || link.source.finishingPositions?.join("|"),
|
|
@@ -45197,7 +45236,9 @@ function positionParticipantAction(params) {
|
|
|
45197
45236
|
};
|
|
45198
45237
|
addPositionActionTelemetry({ drawDefinition, positionAction });
|
|
45199
45238
|
return decorateResult({
|
|
45200
|
-
|
|
45239
|
+
context: { removedParticipantId: removedParticipantId2 },
|
|
45240
|
+
result: { ...SUCCESS },
|
|
45241
|
+
stack
|
|
45201
45242
|
});
|
|
45202
45243
|
}
|
|
45203
45244
|
}
|
|
@@ -45965,8 +46006,8 @@ function addEventEntries(params) {
|
|
|
45965
46006
|
const removedEntries = [];
|
|
45966
46007
|
if (extensions && (!Array.isArray(extensions) || !extensions.every(isValidExtension)) || extension && !isValidExtension({ extension })) {
|
|
45967
46008
|
return decorateResult({
|
|
45968
|
-
result: { error: INVALID_VALUES },
|
|
45969
46009
|
context: definedAttributes({ extension, extensions }),
|
|
46010
|
+
result: { error: INVALID_VALUES },
|
|
45970
46011
|
info: "Invalid extension(s)",
|
|
45971
46012
|
stack
|
|
45972
46013
|
});
|
|
@@ -46071,8 +46112,8 @@ function addEventEntries(params) {
|
|
|
46071
46112
|
const invalidParticipantIds = validParticipantIds.length !== participantIds.length;
|
|
46072
46113
|
if (invalidParticipantIds)
|
|
46073
46114
|
return decorateResult({
|
|
46074
|
-
result: { error: INVALID_PARTICIPANT_IDS },
|
|
46075
46115
|
context: { misMatchedGender, gender: event.gender },
|
|
46116
|
+
result: { error: INVALID_PARTICIPANT_IDS },
|
|
46076
46117
|
stack
|
|
46077
46118
|
});
|
|
46078
46119
|
if (autoEntryPositions) {
|
|
@@ -47627,19 +47668,17 @@ function setOrderOfFinish$1({
|
|
|
47627
47668
|
const stack = "setOrderOfFinish";
|
|
47628
47669
|
if (!Array.isArray(finishingOrder))
|
|
47629
47670
|
return decorateResult({
|
|
47630
|
-
result: {
|
|
47631
|
-
error: INVALID_VALUES
|
|
47632
|
-
},
|
|
47633
47671
|
info: mustBeAnArray("finishingOrder"),
|
|
47672
|
+
result: { error: INVALID_VALUES },
|
|
47634
47673
|
stack
|
|
47635
47674
|
});
|
|
47636
47675
|
const { completedMatchUps, matchUpsMap } = getDrawMatchUps({
|
|
47637
47676
|
inContext: true,
|
|
47638
47677
|
drawDefinition
|
|
47639
47678
|
});
|
|
47640
|
-
const matchUpIds = completedMatchUps?.map(getMatchUpId)
|
|
47679
|
+
const matchUpIds = completedMatchUps?.map(getMatchUpId) ?? [];
|
|
47641
47680
|
const targetMatchUpIds = finishingOrder.map(getMatchUpId);
|
|
47642
|
-
const { matchUpTypes, roundNumbers, structureIds, matchUpTieIds } = (completedMatchUps
|
|
47681
|
+
const { matchUpTypes, roundNumbers, structureIds, matchUpTieIds } = (completedMatchUps ?? []).filter(({ matchUpId }) => targetMatchUpIds.includes(matchUpId)).reduce(
|
|
47643
47682
|
(aggregator, matchUp) => {
|
|
47644
47683
|
const { matchUpTieId, matchUpType, roundNumber, structureId } = matchUp;
|
|
47645
47684
|
if (!aggregator.matchUpTypes.includes(matchUpType))
|
|
@@ -47661,10 +47700,8 @@ function setOrderOfFinish$1({
|
|
|
47661
47700
|
);
|
|
47662
47701
|
if (matchUpTypes.length > 1 || matchUpTieIds.length > 1 || roundNumbers.length > 1 || structureIds.length > 1) {
|
|
47663
47702
|
return decorateResult({
|
|
47664
|
-
result: {
|
|
47665
|
-
error: INVALID_VALUES
|
|
47666
|
-
},
|
|
47667
47703
|
info: "matchUpType, structureId and roundNumber must be equivalent",
|
|
47704
|
+
result: { error: INVALID_VALUES },
|
|
47668
47705
|
stack
|
|
47669
47706
|
});
|
|
47670
47707
|
}
|
|
@@ -47693,7 +47730,7 @@ function setOrderOfFinish$1({
|
|
|
47693
47730
|
const otherCohortMatchUps = completedMatchUps?.filter(
|
|
47694
47731
|
(matchUp) => matchUp.structureId === structureIds[0] && matchUp.roundNumber === roundNumbers[0] && matchUp.matchUpType === matchUpTypes[0] && matchUp.matchUpTieId === matchUpTieIds[0] && !targetedMatchUpIds.includes(matchUp.matchUpId)
|
|
47695
47732
|
);
|
|
47696
|
-
for (const matchUp of otherCohortMatchUps
|
|
47733
|
+
for (const matchUp of otherCohortMatchUps ?? []) {
|
|
47697
47734
|
const { orderOfFinish } = matchUp || {};
|
|
47698
47735
|
if (orderOfFinish) {
|
|
47699
47736
|
if (!isConvertableInteger(orderOfFinish))
|
|
@@ -47707,10 +47744,8 @@ function setOrderOfFinish$1({
|
|
|
47707
47744
|
}
|
|
47708
47745
|
if (uniqueValues(orderOfFinishValues).length !== orderOfFinishValues.length || Math.max(...orderOfFinishValues) > orderOfFinishValues.length) {
|
|
47709
47746
|
return decorateResult({
|
|
47710
|
-
result: {
|
|
47711
|
-
error: INVALID_VALUES
|
|
47712
|
-
},
|
|
47713
47747
|
info: "Values not unique or greater than expected number of values",
|
|
47748
|
+
result: { error: INVALID_VALUES },
|
|
47714
47749
|
stack
|
|
47715
47750
|
});
|
|
47716
47751
|
}
|
|
@@ -50343,10 +50378,8 @@ function addIndividualParticipantIds({
|
|
|
50343
50378
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack });
|
|
50344
50379
|
if (groupingParticipant?.participantType && ![TEAM, GROUP].includes(groupingParticipant.participantType)) {
|
|
50345
50380
|
return decorateResult({
|
|
50346
|
-
result: {
|
|
50347
|
-
error: INVALID_PARTICIPANT_TYPE
|
|
50348
|
-
},
|
|
50349
50381
|
context: { participantType: groupingParticipant.participantType },
|
|
50382
|
+
result: { error: INVALID_PARTICIPANT_TYPE },
|
|
50350
50383
|
stack
|
|
50351
50384
|
});
|
|
50352
50385
|
}
|
|
@@ -52376,7 +52409,7 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
52376
52409
|
const tieMatchUpSide = inContextTieMatchUp?.sides?.find(
|
|
52377
52410
|
(side) => side.sideNumber === sideNumber
|
|
52378
52411
|
);
|
|
52379
|
-
const lineUp = dualMatchUpSide?.lineUp
|
|
52412
|
+
const lineUp = dualMatchUpSide?.lineUp ?? getTeamLineUp({
|
|
52380
52413
|
participantId: teamParticipantId,
|
|
52381
52414
|
drawDefinition
|
|
52382
52415
|
})?.lineUp;
|
|
@@ -54926,8 +54959,8 @@ function deleteDrawDefinitions({
|
|
|
54926
54959
|
const auditTrail = [];
|
|
54927
54960
|
if (!event?.drawDefinitions)
|
|
54928
54961
|
return decorateResult({
|
|
54929
|
-
result: { ...SUCCESS },
|
|
54930
54962
|
info: "event has no drawDefinition",
|
|
54963
|
+
result: { ...SUCCESS },
|
|
54931
54964
|
stack
|
|
54932
54965
|
});
|
|
54933
54966
|
const eventDrawIds = event.drawDefinitions.map(({ drawId: drawId2 }) => drawId2);
|
|
@@ -54936,8 +54969,8 @@ function deleteDrawDefinitions({
|
|
|
54936
54969
|
drawIds = drawIds.filter((drawId2) => eventDrawIds.includes(drawId2));
|
|
54937
54970
|
if (!drawIds.length)
|
|
54938
54971
|
return decorateResult({
|
|
54939
|
-
result: { ...SUCCESS },
|
|
54940
54972
|
info: "nothing to do; no matching drawIds in event.",
|
|
54973
|
+
result: { ...SUCCESS },
|
|
54941
54974
|
stack
|
|
54942
54975
|
});
|
|
54943
54976
|
const flightProfile = makeDeepCopy(
|
|
@@ -55485,6 +55518,7 @@ const DOMINANT_DUO = "DOMINANT_DUO";
|
|
|
55485
55518
|
const DOMINANT_DUO_MIXED = "DOMINANT_DUO_MIXED";
|
|
55486
55519
|
const LAVER_CUP = "LAVER_CUP";
|
|
55487
55520
|
const TEAM_DOUBLES_3_AGGREGATION = "TEAM_DOUBLES_3_AGGREGATION";
|
|
55521
|
+
const TIME_TENNIS = "TIME_TENNIS";
|
|
55488
55522
|
const USTA_BREWER_CUP = "USTA_BREWER_CUP";
|
|
55489
55523
|
const USTA_OZAKI_CUP = "USTA_OZAKI_CUP";
|
|
55490
55524
|
const USTA_COLLEGE = "USTA_COLLEGE";
|
|
@@ -55504,6 +55538,7 @@ const tieFormatConstants = {
|
|
|
55504
55538
|
DOMINANT_DUO_MIXED,
|
|
55505
55539
|
LAVER_CUP,
|
|
55506
55540
|
TEAM_DOUBLES_3_AGGREGATION,
|
|
55541
|
+
TIME_TENNIS,
|
|
55507
55542
|
USTA_BREWER_CUP,
|
|
55508
55543
|
USTA_OZAKI_CUP,
|
|
55509
55544
|
USTA_COLLEGE,
|
|
@@ -55574,6 +55609,7 @@ const namedFormats = {
|
|
|
55574
55609
|
[DOMINANT_DUO]: DOMINANT_DUO_TIE_FORMAT,
|
|
55575
55610
|
[DOMINANT_DUO_MIXED]: DOMINANT_DUO_MIXED_TIE_FORMAT,
|
|
55576
55611
|
[TEAM_DOUBLES_3_AGGREGATION]: TEAM_AGGREGATION_TIE_FORMAT,
|
|
55612
|
+
[TIME_TENNIS]: TIME_TENNIS_TIE_FORMAT,
|
|
55577
55613
|
[USTA_BREWER_CUP]: USTA_BREWER_CUP_TIE_FORMAT,
|
|
55578
55614
|
[USTA_OZAKI_CUP]: USTA_OZAKI_CUP_TIE_FORMAT,
|
|
55579
55615
|
[USTA_COLLEGE]: USTA_COLLEGE_TIE_FORMAT,
|
|
@@ -57791,6 +57827,7 @@ function addVoluntaryConsolationStructure(params) {
|
|
|
57791
57827
|
}
|
|
57792
57828
|
|
|
57793
57829
|
function prepareStage(params) {
|
|
57830
|
+
const stack = "prepareStage";
|
|
57794
57831
|
let { seedsCount } = params;
|
|
57795
57832
|
const preparedStructureIds = params.preparedStructureIds || [];
|
|
57796
57833
|
const {
|
|
@@ -57846,7 +57883,7 @@ function prepareStage(params) {
|
|
|
57846
57883
|
({ structureId: structureId2 }) => !preparedStructureIds.includes(structureId2)
|
|
57847
57884
|
);
|
|
57848
57885
|
if (!structure)
|
|
57849
|
-
return decorateResult({ result: { error: STRUCTURE_NOT_FOUND } });
|
|
57886
|
+
return decorateResult({ result: { error: STRUCTURE_NOT_FOUND }, stack });
|
|
57850
57887
|
const structureId = structure?.structureId;
|
|
57851
57888
|
const seedBlockInfo = structure ? getValidSeedBlocks({
|
|
57852
57889
|
provisionalPositioning,
|
|
@@ -57969,7 +58006,7 @@ function prepareStage(params) {
|
|
|
57969
58006
|
positionAssignments = result?.positionAssignments;
|
|
57970
58007
|
positioningReport = result?.positioningReport;
|
|
57971
58008
|
if (result.error) {
|
|
57972
|
-
return decorateResult({ result, stack
|
|
58009
|
+
return decorateResult({ result, stack });
|
|
57973
58010
|
}
|
|
57974
58011
|
}
|
|
57975
58012
|
return {
|
|
@@ -58115,10 +58152,8 @@ function generateDrawDefinition(params) {
|
|
|
58115
58152
|
if (policyDefinitions) {
|
|
58116
58153
|
if (typeof policyDefinitions !== "object") {
|
|
58117
58154
|
return decorateResult({
|
|
58118
|
-
|
|
58119
|
-
|
|
58120
|
-
error: INVALID_VALUES
|
|
58121
|
-
},
|
|
58155
|
+
info: "policyDefinitions must be an object",
|
|
58156
|
+
result: { error: INVALID_VALUES },
|
|
58122
58157
|
stack
|
|
58123
58158
|
});
|
|
58124
58159
|
} else {
|
|
@@ -58347,8 +58382,9 @@ function generateDrawDefinition(params) {
|
|
|
58347
58382
|
for (const roundTargetProfile of params.qualifyingProfiles) {
|
|
58348
58383
|
if (!Array.isArray(roundTargetProfile.structureProfiles))
|
|
58349
58384
|
return decorateResult({
|
|
58385
|
+
info: mustBeAnArray("structureProfiles"),
|
|
58350
58386
|
result: { error: MISSING_VALUE },
|
|
58351
|
-
|
|
58387
|
+
stack
|
|
58352
58388
|
});
|
|
58353
58389
|
roundTarget = roundTargetProfile.roundTarget || roundTarget;
|
|
58354
58390
|
const sortedStructureProfiles = roundTargetProfile.structureProfiles?.sort(sequenceSort) || [];
|
|
@@ -58579,12 +58615,12 @@ function modifyEvent({
|
|
|
58579
58615
|
const enteredParticipantIds = event?.entries?.filter(({ entryStatus }) => {
|
|
58580
58616
|
const status = entryStatus;
|
|
58581
58617
|
return [...STRUCTURE_SELECTED_STATUSES, ALTERNATE].includes(status);
|
|
58582
|
-
}).map(({ participantId }) => participantId)
|
|
58618
|
+
}).map(({ participantId }) => participantId) ?? [];
|
|
58583
58619
|
const enteredParticipants = enteredParticipantIds ? getParticipants$1({
|
|
58584
58620
|
participantFilters: { participantIds: enteredParticipantIds },
|
|
58585
58621
|
withIndividualParticipants: true,
|
|
58586
58622
|
tournamentRecord
|
|
58587
|
-
}).participants
|
|
58623
|
+
}).participants ?? [] : [];
|
|
58588
58624
|
const genderAccumulator = [];
|
|
58589
58625
|
const enteredParticipantTypes = enteredParticipants.reduce(
|
|
58590
58626
|
(types, participant) => {
|
|
@@ -58595,7 +58631,7 @@ function modifyEvent({
|
|
|
58595
58631
|
[]
|
|
58596
58632
|
);
|
|
58597
58633
|
const enteredParticipantGenders = unique(genderAccumulator);
|
|
58598
|
-
const validGender = !enteredParticipantGenders.length || [MIXED, ANY].includes(eventUpdates.gender
|
|
58634
|
+
const validGender = !enteredParticipantGenders.length || [MIXED, ANY].includes(eventUpdates.gender ?? "") || enteredParticipantGenders.length === 1 && enteredParticipantGenders[0] === eventUpdates.gender;
|
|
58599
58635
|
if (eventUpdates.gender && !validGender)
|
|
58600
58636
|
return decorateResult({
|
|
58601
58637
|
context: { gender: eventUpdates.gender },
|
|
@@ -58606,14 +58642,14 @@ function modifyEvent({
|
|
|
58606
58642
|
SINGLES,
|
|
58607
58643
|
TEAM$1
|
|
58608
58644
|
];
|
|
58609
|
-
const validEventType = validEventTypes.includes(eventUpdates.eventType
|
|
58645
|
+
const validEventType = validEventTypes.includes(eventUpdates.eventType ?? "");
|
|
58610
58646
|
if (eventUpdates.eventType && !validEventType)
|
|
58611
58647
|
return decorateResult({
|
|
58612
58648
|
context: { participantType: eventUpdates.eventType },
|
|
58613
58649
|
result: { error: INVALID_VALUES }
|
|
58614
58650
|
});
|
|
58615
58651
|
if (eventUpdates.eventType)
|
|
58616
|
-
event.eventType
|
|
58652
|
+
event.eventType = eventUpdates.eventType;
|
|
58617
58653
|
if (eventUpdates.eventName)
|
|
58618
58654
|
event.eventName = eventUpdates.eventName;
|
|
58619
58655
|
if (eventUpdates.gender)
|
|
@@ -60580,6 +60616,7 @@ var lastNames = [
|
|
|
60580
60616
|
"Midgely",
|
|
60581
60617
|
"Mond",
|
|
60582
60618
|
"Montoya",
|
|
60619
|
+
"Moore",
|
|
60583
60620
|
"Murry",
|
|
60584
60621
|
"Nagle",
|
|
60585
60622
|
"Nearing",
|
|
@@ -60643,6 +60680,8 @@ var firstFemale = [
|
|
|
60643
60680
|
"Erin",
|
|
60644
60681
|
"Eva",
|
|
60645
60682
|
"Evelyn",
|
|
60683
|
+
"Heather",
|
|
60684
|
+
"Helen",
|
|
60646
60685
|
"Hermia",
|
|
60647
60686
|
"Hypatia",
|
|
60648
60687
|
"Imogen",
|
|
@@ -60650,8 +60689,6 @@ var firstFemale = [
|
|
|
60650
60689
|
"Jasmine",
|
|
60651
60690
|
"Juliana",
|
|
60652
60691
|
"Juliet",
|
|
60653
|
-
"Heather",
|
|
60654
|
-
"Helen",
|
|
60655
60692
|
"Katniss",
|
|
60656
60693
|
"Leeloo",
|
|
60657
60694
|
"Lenina",
|
|
@@ -60697,6 +60734,7 @@ var firstMale = [
|
|
|
60697
60734
|
"Axel",
|
|
60698
60735
|
"Barda",
|
|
60699
60736
|
"Bill",
|
|
60737
|
+
"Bruce",
|
|
60700
60738
|
"Charles",
|
|
60701
60739
|
"Chris",
|
|
60702
60740
|
"Darwin",
|
|
@@ -60732,6 +60770,7 @@ var firstMale = [
|
|
|
60732
60770
|
"Michael",
|
|
60733
60771
|
"Mustapha",
|
|
60734
60772
|
"Neil",
|
|
60773
|
+
"Nikola",
|
|
60735
60774
|
"Octavio",
|
|
60736
60775
|
"Palmer",
|
|
60737
60776
|
"Paul",
|
|
@@ -60740,12 +60779,14 @@ var firstMale = [
|
|
|
60740
60779
|
"Rick",
|
|
60741
60780
|
"Rincewind",
|
|
60742
60781
|
"Roy",
|
|
60782
|
+
"Shannon",
|
|
60743
60783
|
"Sheldon",
|
|
60744
60784
|
"Stafford",
|
|
60745
60785
|
"Stanislaw",
|
|
60746
60786
|
"Stanley",
|
|
60747
60787
|
"Syme",
|
|
60748
60788
|
"Thorstein",
|
|
60789
|
+
"Thomas",
|
|
60749
60790
|
"Tyrone",
|
|
60750
60791
|
"Vizzini",
|
|
60751
60792
|
"Walton",
|
|
@@ -60754,7 +60795,8 @@ var firstMale = [
|
|
|
60754
60795
|
"Wendell",
|
|
60755
60796
|
"Westley",
|
|
60756
60797
|
"William",
|
|
60757
|
-
"Winston"
|
|
60798
|
+
"Winston",
|
|
60799
|
+
"Zoran"
|
|
60758
60800
|
];
|
|
60759
60801
|
var namesData$1 = {
|
|
60760
60802
|
lastNames: lastNames,
|