tods-competition-factory 2.2.32-beta.0 → 2.2.32-beta.1
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/index.mjs +9 -9
- package/dist/tods-competition-factory.d.ts +2 -2
- package/dist/tods-competition-factory.development.cjs.js +53 -39
- 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 +23 -23
|
@@ -4625,11 +4625,11 @@ declare function deleteFlightProfileAndFlightDraws({ autoPublish, tournamentReco
|
|
|
4625
4625
|
event: any;
|
|
4626
4626
|
force: any;
|
|
4627
4627
|
}): {
|
|
4628
|
-
error: any;
|
|
4629
|
-
} | {
|
|
4630
4628
|
success?: boolean;
|
|
4631
4629
|
error?: ErrorType;
|
|
4632
4630
|
info?: any;
|
|
4631
|
+
} | {
|
|
4632
|
+
error: any;
|
|
4633
4633
|
};
|
|
4634
4634
|
|
|
4635
4635
|
type ModifyEventMatchUpFormatTimingArgs = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.2.32-beta.
|
|
6
|
+
return '2.2.32-beta.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -653,6 +653,10 @@ const INCOMPATIBLE_MATCHUP_STATUS = {
|
|
|
653
653
|
message: 'Incompatible matchUpStatus',
|
|
654
654
|
code: 'ERR_INCOMPATIBLE_MATCHUP_STATUS',
|
|
655
655
|
};
|
|
656
|
+
const PROPAGATED_EXITS_DOWNSTREAM = {
|
|
657
|
+
message: 'Propagated exits downstream',
|
|
658
|
+
code: 'ERR_PROPAGATED_EXITS_DOWNSTREAM',
|
|
659
|
+
};
|
|
656
660
|
const INVALID_MATCHUP_STATUS = {
|
|
657
661
|
message: 'Invalid matchUpStatus',
|
|
658
662
|
code: 'ERR_INVALID_MATCHUP_STATUS',
|
|
@@ -12340,6 +12344,10 @@ function purgeGlobalLog() {
|
|
|
12340
12344
|
globalLog.length = 0;
|
|
12341
12345
|
}
|
|
12342
12346
|
|
|
12347
|
+
function isExit(matchUpStatus) {
|
|
12348
|
+
return [DEFAULTED, WALKOVER$2].includes(matchUpStatus);
|
|
12349
|
+
}
|
|
12350
|
+
|
|
12343
12351
|
function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tournamentRecord, drawDefinition, drawPosition, loserMatchUp, matchUpsMap, structureId, structure, event, }) {
|
|
12344
12352
|
if (!drawDefinition)
|
|
12345
12353
|
return { error: MISSING_DRAW_DEFINITION };
|
|
@@ -12363,7 +12371,7 @@ function assignDrawPositionBye({ provisionalPositioning, isPositionAction, tourn
|
|
|
12363
12371
|
if (currentAssignment?.bye) {
|
|
12364
12372
|
return { ...SUCCESS };
|
|
12365
12373
|
}
|
|
12366
|
-
const hasPropagatedStatus = !!(loserMatchUp && matchUpsMap.drawMatchUps.find((m) => m.loserMatchUpId === loserMatchUp?.matchUpId &&
|
|
12374
|
+
const hasPropagatedStatus = !!(loserMatchUp && matchUpsMap.drawMatchUps.find((m) => m.loserMatchUpId === loserMatchUp?.matchUpId && isExit(m.matchUpStatus)));
|
|
12367
12375
|
const drawPositionIsActive = activeDrawPositions?.includes(drawPosition);
|
|
12368
12376
|
if (drawPositionIsActive && !hasPropagatedStatus) {
|
|
12369
12377
|
return { error: DRAW_POSITION_ACTIVE };
|
|
@@ -12965,12 +12973,10 @@ function removeDrawPosition$1({ inContextDrawMatchUps, positionAssignments, tour
|
|
|
12965
12973
|
const matchUpAssignments = positionAssignments.filter(({ drawPosition }) => targetMatchUp.drawPositions?.includes(drawPosition));
|
|
12966
12974
|
const matchUpContainsBye = matchUpAssignments.filter((assignment) => assignment.bye).length;
|
|
12967
12975
|
const newMatchUpStatus = (matchUpContainsBye && BYE) ||
|
|
12968
|
-
(targetMatchUp.matchUpStatus &&
|
|
12969
|
-
[DEFAULTED, WALKOVER$2].includes(targetMatchUp.matchUpStatus) &&
|
|
12970
|
-
targetMatchUp.matcHUpStatus) ||
|
|
12976
|
+
(targetMatchUp.matchUpStatus && isExit(targetMatchUp.matchUpStatus) && targetMatchUp.matcHUpStatus) ||
|
|
12971
12977
|
TO_BE_PLAYED;
|
|
12972
12978
|
targetMatchUp.matchUpStatus = newMatchUpStatus;
|
|
12973
|
-
if (targetMatchUp.matchUpStatus &&
|
|
12979
|
+
if (targetMatchUp.matchUpStatus && isExit(targetMatchUp.matchUpStatus))
|
|
12974
12980
|
targetMatchUp.winningSide = undefined;
|
|
12975
12981
|
const removedDrawPosition = initialDrawPositions?.find((position) => !targetMatchUp.drawPositions?.includes(position));
|
|
12976
12982
|
const noChange = initialDrawPositions?.includes(drawPosition) &&
|
|
@@ -14250,7 +14256,7 @@ function getParticipantEntries(params) {
|
|
|
14250
14256
|
const scheduledMinutes = timeStringMinutes$1(scheduledTime);
|
|
14251
14257
|
for (const consideredItem of scheduleItemsToConsider) {
|
|
14252
14258
|
const ignoreItem = consideredItem.matchUpId === scheduleItem.matchUpId ||
|
|
14253
|
-
(
|
|
14259
|
+
(isExit(consideredItem.matchUpStatus) && !consideredItem.checkScoreHasValue);
|
|
14254
14260
|
if (ignoreItem)
|
|
14255
14261
|
continue;
|
|
14256
14262
|
const typeChange = scheduleItem.matchUpType !== consideredItem.matchUpType;
|
|
@@ -16699,9 +16705,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
|
|
|
16699
16705
|
});
|
|
16700
16706
|
const matchUpAssignments = positionAssignments?.filter((assignment) => updatedDrawPositions.includes(assignment.drawPosition));
|
|
16701
16707
|
const isByeMatchUp = matchUpAssignments?.find(({ bye }) => bye);
|
|
16702
|
-
const isDoubleExitExit = matchUp?.matchUpStatus &&
|
|
16703
|
-
[WALKOVER$2, DEFAULTED].includes(matchUp.matchUpStatus) &&
|
|
16704
|
-
updatedDrawPositions.filter(Boolean).length < 2;
|
|
16708
|
+
const isDoubleExitExit = matchUp?.matchUpStatus && isExit(matchUp.matchUpStatus) && updatedDrawPositions.filter(Boolean).length < 2;
|
|
16705
16709
|
matchUpStatus =
|
|
16706
16710
|
(isByeMatchUp && BYE) ||
|
|
16707
16711
|
matchUpStatus ||
|
|
@@ -16710,7 +16714,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
|
|
|
16710
16714
|
[DOUBLE_WALKOVER, DOUBLE_DEFAULT].includes(matchUp.matchUpStatus) &&
|
|
16711
16715
|
matchUp.matchUpStatus) ||
|
|
16712
16716
|
TO_BE_PLAYED;
|
|
16713
|
-
const
|
|
16717
|
+
const isPropagatedExit = !!(isExit(matchUp?.matchUpStatus) && matchUp?.winningSide);
|
|
16714
16718
|
if (matchUp && positionAdded) {
|
|
16715
16719
|
inContextDrawMatchUps =
|
|
16716
16720
|
getAllDrawMatchUps({
|
|
@@ -16724,7 +16728,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
|
|
|
16724
16728
|
drawPosition,
|
|
16725
16729
|
matchUpId,
|
|
16726
16730
|
}))
|
|
16727
|
-
|| (
|
|
16731
|
+
|| (isPropagatedExit && matchUp.winningSide)
|
|
16728
16732
|
|| undefined;
|
|
16729
16733
|
if (matchUp?.matchUpStatusCodes) {
|
|
16730
16734
|
updateMatchUpStatusCodes({
|
|
@@ -16738,7 +16742,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
|
|
|
16738
16742
|
Object.assign(matchUp, {
|
|
16739
16743
|
drawPositions: updatedDrawPositions,
|
|
16740
16744
|
winningSide: exitWinningSide,
|
|
16741
|
-
matchUpStatus:
|
|
16745
|
+
matchUpStatus: isPropagatedExit ? matchUp?.matchUpStatus : matchUpStatus,
|
|
16742
16746
|
});
|
|
16743
16747
|
modifyMatchUpNotice({
|
|
16744
16748
|
tournamentId: tournamentRecord?.tournamentId,
|
|
@@ -16781,7 +16785,7 @@ function assignMatchUpDrawPosition({ inContextDrawMatchUps, sourceMatchUpStatus,
|
|
|
16781
16785
|
}
|
|
16782
16786
|
}
|
|
16783
16787
|
}
|
|
16784
|
-
else if (positionAssigned &&
|
|
16788
|
+
else if (positionAssigned && isPropagatedExit) {
|
|
16785
16789
|
if (winnerMatchUp) {
|
|
16786
16790
|
const result = assignMatchUpDrawPosition({
|
|
16787
16791
|
matchUpId: winnerMatchUp.matchUpId,
|
|
@@ -23283,7 +23287,7 @@ function attemptToModifyScore(params) {
|
|
|
23283
23287
|
const validToScore = hasAdHocSides ||
|
|
23284
23288
|
drawPositionsAssignedParticipantIds({ structure, matchUp, inContextMatchUp }) ||
|
|
23285
23289
|
params.appliedPolicies?.[POLICY_TYPE_SCORING]?.requireParticipantsForScoring === false ||
|
|
23286
|
-
(
|
|
23290
|
+
(isExit(matchUpStatus) && participantsCount === 1 && propagateExitStatus);
|
|
23287
23291
|
if (!validToScore)
|
|
23288
23292
|
return decorateResult({ result: { error: MISSING_ASSIGNMENTS }, stack });
|
|
23289
23293
|
const removeScore = [WALKOVER$2].includes(matchUpStatus);
|
|
@@ -25704,7 +25708,7 @@ function getValidModifyAssignedPairAction({ tournamentParticipants, returnPartic
|
|
|
25704
25708
|
}
|
|
25705
25709
|
|
|
25706
25710
|
function isActiveDownstream(params) {
|
|
25707
|
-
const { inContextDrawMatchUps, targetData, drawDefinition, relevantLink
|
|
25711
|
+
const { inContextDrawMatchUps, targetData, drawDefinition, relevantLink } = params;
|
|
25708
25712
|
const fmlcBYE = relevantLink?.linkCondition === FIRST_MATCHUP && targetData?.matchUp?.matchUpStatus === BYE;
|
|
25709
25713
|
if (fmlcBYE)
|
|
25710
25714
|
return false;
|
|
@@ -25718,20 +25722,16 @@ function isActiveDownstream(params) {
|
|
|
25718
25722
|
const loserExitPropagation = loserTargetData?.targetMatchUps?.loserMatchUp;
|
|
25719
25723
|
const loserIndex = loserTargetData?.targetMatchUps?.loserMatchUpDrawPositionIndex;
|
|
25720
25724
|
const propagatedLoserParticipant = loserExitPropagation?.sides[loserIndex]?.participant;
|
|
25721
|
-
const
|
|
25722
|
-
const
|
|
25723
|
-
const hasLoserMatchUpUpstreamWOMatches = !!matchUpsMap?.drawMatchUps.find((m) => m.loserMatchUpId === loserMatchUp?.matchUpId && [DEFAULTED, WALKOVER$2, WITHDRAWN].includes(m.matchUpStatus));
|
|
25725
|
+
const isLoserMatchUpWO = isExit(loserMatchUp?.matchUpStatus);
|
|
25726
|
+
const loserMatchUpExit = isLoserMatchUpWO && !propagatedLoserParticipant;
|
|
25724
25727
|
const loserMatchUpParticipantsCount = loserMatchUp?.sides?.reduce((acc, current) => (current?.participant ? ++acc : acc), 0) ?? 0;
|
|
25725
25728
|
const isLoserMatchUpWalkoverWithOnePlayer = loserMatchUp?.winningSide && isLoserMatchUpWO && loserMatchUpParticipantsCount === 1;
|
|
25726
|
-
const isClearScore = matchUpStatus === TO_BE_PLAYED && score?.scoreStringSide1 === '' && score?.scoreStringSide2 === '' && !winningSide;
|
|
25727
25729
|
const winnerDrawPositionsCount = winnerMatchUp?.drawPositions?.filter(Boolean).length || 0;
|
|
25728
|
-
if (
|
|
25729
|
-
(
|
|
25730
|
-
|
|
25731
|
-
|
|
25732
|
-
(winnerMatchUp?.
|
|
25733
|
-
winnerDrawPositionsCount === 2 &&
|
|
25734
|
-
(!winnerMatchUp.feedRound || ![WALKOVER$2, DEFAULTED].includes(winnerMatchUp?.matchUpStatus)))))) {
|
|
25730
|
+
if (!isLoserMatchUpWalkoverWithOnePlayer &&
|
|
25731
|
+
((loserMatchUp?.winningSide && !loserMatchUpExit) ||
|
|
25732
|
+
(winnerMatchUp?.winningSide &&
|
|
25733
|
+
winnerDrawPositionsCount === 2 &&
|
|
25734
|
+
(!winnerMatchUp.feedRound || !isExit(winnerMatchUp?.matchUpStatus))))) {
|
|
25735
25735
|
return true;
|
|
25736
25736
|
}
|
|
25737
25737
|
const winnerTargetData = winnerMatchUp &&
|
|
@@ -43262,10 +43262,8 @@ function removeDrawPosition({ inContextDrawMatchUps, positionAssignments, source
|
|
|
43262
43262
|
const matchUpAssignments = positionAssignments.filter(({ drawPosition }) => matchUp.drawPositions?.includes(drawPosition));
|
|
43263
43263
|
const matchUpContainsBye = matchUpAssignments.filter((assignment) => assignment.bye).length;
|
|
43264
43264
|
matchUp.matchUpStatus =
|
|
43265
|
-
(matchUpContainsBye && BYE) ||
|
|
43266
|
-
|
|
43267
|
-
TO_BE_PLAYED;
|
|
43268
|
-
if ([WALKOVER$2, DEFAULTED].includes(matchUp.matchUpStatus))
|
|
43265
|
+
(matchUpContainsBye && BYE) || (isExit(matchUp.matchUpStatus) && matchUp.matchUpStatus) || TO_BE_PLAYED;
|
|
43266
|
+
if (isExit(matchUp.matchUpStatus))
|
|
43269
43267
|
matchUp.winningSide = undefined;
|
|
43270
43268
|
if (matchUp.matchUpStatusCodes) {
|
|
43271
43269
|
updateMatchUpStatusCodes({
|
|
@@ -43573,7 +43571,7 @@ function doubleExitAdvancement(params) {
|
|
|
43573
43571
|
return decorateResult({ result: { ...SUCCESS }, stack });
|
|
43574
43572
|
const { matchUp: sourceMatchUp, targetMatchUps, targetLinks } = targetData;
|
|
43575
43573
|
const { loserMatchUp, winnerMatchUp, loserTargetDrawPosition } = targetMatchUps;
|
|
43576
|
-
const loserMatchUpIsEmptyExit =
|
|
43574
|
+
const loserMatchUpIsEmptyExit = isExit(loserMatchUp?.matchUpStatus) &&
|
|
43577
43575
|
!loserMatchUp.sides?.map((side) => side.participantId ?? side.participant).filter(Boolean).length;
|
|
43578
43576
|
const loserMatchUpIsDoubleExit = loserMatchUp?.matchUpStatus === DOUBLE_WALKOVER;
|
|
43579
43577
|
if (loserMatchUp && loserMatchUp.matchUpStatus !== BYE) {
|
|
@@ -43669,7 +43667,7 @@ function conditionallyAdvanceDrawPosition(params) {
|
|
|
43669
43667
|
inContextDrawMatchUps,
|
|
43670
43668
|
})) ||
|
|
43671
43669
|
undefined;
|
|
43672
|
-
const existingExit =
|
|
43670
|
+
const existingExit = isExit(noContextTargetMatchUp.matchUpStatus) && !drawPositions.length;
|
|
43673
43671
|
const isFinal = noContextTargetMatchUp.finishingRound === 1;
|
|
43674
43672
|
const matchUpStatus = existingExit && !isFinal ? DOUBLE_EXIT : EXIT;
|
|
43675
43673
|
const inContextPairedPreviousMatchUp = inContextDrawMatchUps.find((candidate) => candidate.matchUpId === pairedPreviousMatchUp.matchUpId);
|
|
@@ -43787,7 +43785,7 @@ function conditionallyAdvanceDrawPosition(params) {
|
|
|
43787
43785
|
matchUpsMap,
|
|
43788
43786
|
});
|
|
43789
43787
|
}
|
|
43790
|
-
else if (
|
|
43788
|
+
else if (isExit(nextWinnerMatchUp.matchUpStatus)) {
|
|
43791
43789
|
const result = doubleExitAdvancement({
|
|
43792
43790
|
...params,
|
|
43793
43791
|
matchUpId: noContextNextWinnerMatchUp.matchUpId,
|
|
@@ -43820,7 +43818,7 @@ function conditionallyAdvanceDrawPosition(params) {
|
|
|
43820
43818
|
walkoverWinningSide,
|
|
43821
43819
|
});
|
|
43822
43820
|
}
|
|
43823
|
-
const matchUpStatus =
|
|
43821
|
+
const matchUpStatus = isExit(noContextNextWinnerMatchUp.matchUpStatus) ? EXIT : DOUBLE_EXIT;
|
|
43824
43822
|
const result = modifyMatchUpScore({
|
|
43825
43823
|
matchUpId: noContextNextWinnerMatchUp.matchUpId,
|
|
43826
43824
|
appliedPolicies: params.appliedPolicies,
|
|
@@ -44460,7 +44458,7 @@ function noDownstreamDependencies(params) {
|
|
|
44460
44458
|
}
|
|
44461
44459
|
const triggerDualWinningSide = [CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && params.dualWinningSideChange;
|
|
44462
44460
|
const statusNotToBePlayed = matchUpStatus && matchUpStatus !== TO_BE_PLAYED;
|
|
44463
|
-
const propagateExitStatus = params.propagateExitStatus &&
|
|
44461
|
+
const propagateExitStatus = params.propagateExitStatus && isExit(matchUpStatus);
|
|
44464
44462
|
const result = ((winningSide || triggerDualWinningSide || propagateExitStatus) && attemptToSetWinningSide(params)) ||
|
|
44465
44463
|
(scoreWithNoWinningSide && removeDirected(removeScore)) ||
|
|
44466
44464
|
(statusNotToBePlayed && attemptToSetMatchUpStatus(params)) ||
|
|
@@ -45207,6 +45205,15 @@ function addMatchUpResumeTime({ removePriorValues, tournamentRecord, drawDefinit
|
|
|
45207
45205
|
}
|
|
45208
45206
|
}
|
|
45209
45207
|
|
|
45208
|
+
function hasPropagatedExitDownstream(params) {
|
|
45209
|
+
const { targetData, matchUpsMap } = params;
|
|
45210
|
+
const { targetMatchUps: { loserMatchUp }, } = targetData;
|
|
45211
|
+
const isLoserMatchUpWO = isExit(loserMatchUp?.matchUpStatus);
|
|
45212
|
+
const hasLoserMatchUpUpstreamWOMatches = !!matchUpsMap?.drawMatchUps.find((m) => m.loserMatchUpId === loserMatchUp?.matchUpId && isExit(m.matchUpStatus));
|
|
45213
|
+
return ((hasLoserMatchUpUpstreamWOMatches && loserMatchUp?.matchUpStatus === DOUBLE_WALKOVER) ||
|
|
45214
|
+
(hasLoserMatchUpUpstreamWOMatches && isLoserMatchUpWO));
|
|
45215
|
+
}
|
|
45216
|
+
|
|
45210
45217
|
function getProjectedDualWinningSide({ drawDefinition, matchUpStatus, matchUpsMap, winningSide, dualMatchUp, tieFormat, structure, matchUp, event, score, }) {
|
|
45211
45218
|
const projectedDualMatchUp = makeDeepCopy(dualMatchUp, undefined, true);
|
|
45212
45219
|
for (const tieMatchUp of projectedDualMatchUp?.tieMatchUps || []) {
|
|
@@ -45344,6 +45351,13 @@ function setMatchUpState(params) {
|
|
|
45344
45351
|
structure,
|
|
45345
45352
|
matchUp,
|
|
45346
45353
|
});
|
|
45354
|
+
const isClearScore = matchUpStatus === TO_BE_PLAYED && score?.scoreStringSide1 === '' && score?.scoreStringSide2 === '' && !winningSide;
|
|
45355
|
+
const propagatedExitDownStream = hasPropagatedExitDownstream(params);
|
|
45356
|
+
if (propagatedExitDownStream && isClearScore) {
|
|
45357
|
+
return {
|
|
45358
|
+
error: PROPAGATED_EXITS_DOWNSTREAM,
|
|
45359
|
+
};
|
|
45360
|
+
}
|
|
45347
45361
|
const activeDownstream = isActiveDownstream(params);
|
|
45348
45362
|
let dualWinningSideChange;
|
|
45349
45363
|
if (isTeam) {
|
|
@@ -45932,7 +45946,7 @@ function progressExitStatus({ sourceMatchUpStatusCodes, propagateExitStatus, sou
|
|
|
45932
45946
|
color: 'magenta',
|
|
45933
45947
|
method: stack,
|
|
45934
45948
|
});
|
|
45935
|
-
const carryOverMatchUpStatus = (
|
|
45949
|
+
const carryOverMatchUpStatus = (isExit(sourceMatchUpStatus) && sourceMatchUpStatus) || WALKOVER$2;
|
|
45936
45950
|
const inContextMatchUps = getAllDrawMatchUps({
|
|
45937
45951
|
inContext: true,
|
|
45938
45952
|
drawDefinition,
|
|
@@ -45953,7 +45967,7 @@ function progressExitStatus({ sourceMatchUpStatusCodes, propagateExitStatus, sou
|
|
|
45953
45967
|
statusCodes[0] = sourceMatchUpStatusCodes[0];
|
|
45954
45968
|
}
|
|
45955
45969
|
else {
|
|
45956
|
-
if (!
|
|
45970
|
+
if (!isExit(loserMatchUp.matchUpStatus)) {
|
|
45957
45971
|
winningSide = loserParticipantSide.sideNumber === 1 ? 2 : 1;
|
|
45958
45972
|
statusCodes[0] = sourceMatchUpStatusCodes[0];
|
|
45959
45973
|
}
|
|
@@ -49876,7 +49890,7 @@ function generateOutcome(params) {
|
|
|
49876
49890
|
COMPLETED$1,
|
|
49877
49891
|
])[1];
|
|
49878
49892
|
const noScore = { sets: [], scoreStringSide1: '', side2ScoreString: '' };
|
|
49879
|
-
if (
|
|
49893
|
+
if (isExit(matchUpStatus)) {
|
|
49880
49894
|
winningSide = winningSide || randomInt(1, 2);
|
|
49881
49895
|
const outcome = {
|
|
49882
49896
|
score: noScore,
|