tods-competition-factory 2.2.4 → 2.2.6
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 +6 -6
- package/dist/tods-competition-factory.d.ts +3 -1
- package/dist/tods-competition-factory.development.cjs.js +32 -26
- 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 +12 -12
|
@@ -5377,6 +5377,7 @@ type SetMatchUpStatusArgs = {
|
|
|
5377
5377
|
enableAutoCalc?: boolean;
|
|
5378
5378
|
matchUpFormat?: string;
|
|
5379
5379
|
tournamentId?: string;
|
|
5380
|
+
setTBlast?: boolean;
|
|
5380
5381
|
matchUpId: string;
|
|
5381
5382
|
eventId?: string;
|
|
5382
5383
|
drawId?: string;
|
|
@@ -5726,7 +5727,7 @@ type CompetitionMatchUpsArgs$1 = {
|
|
|
5726
5727
|
nextMatchUps?: boolean;
|
|
5727
5728
|
inContext?: boolean;
|
|
5728
5729
|
};
|
|
5729
|
-
declare function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecoveryTimes, participantsProfile, tournamentRecords, policyDefinitions, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs$1): {
|
|
5730
|
+
declare function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecoveryTimes, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs$1): {
|
|
5730
5731
|
matchUps?: HydratedMatchUp[];
|
|
5731
5732
|
error?: ErrorType;
|
|
5732
5733
|
};
|
|
@@ -8731,6 +8732,7 @@ type GenerateScoreString = {
|
|
|
8731
8732
|
matchUpFormat?: string;
|
|
8732
8733
|
winnerFirst?: boolean;
|
|
8733
8734
|
winningSide?: number;
|
|
8735
|
+
setTBlast?: boolean;
|
|
8734
8736
|
reversed?: boolean;
|
|
8735
8737
|
sets: any;
|
|
8736
8738
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.2.
|
|
6
|
+
return '2.2.6';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -11541,7 +11541,7 @@ function getDrawMatchUps(params) {
|
|
|
11541
11541
|
|
|
11542
11542
|
function allEventMatchUps(params) {
|
|
11543
11543
|
let { participants = [], contextContent, participantMap } = params;
|
|
11544
|
-
const { scheduleVisibilityFilters, tournamentAppliedPolicies, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, contextFilters, contextProfile, matchUpFilters, nextMatchUps, inContext, context, event, } = params;
|
|
11544
|
+
const { scheduleVisibilityFilters, tournamentAppliedPolicies, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, usePublishState, contextFilters, contextProfile, matchUpFilters, nextMatchUps, inContext, context, event, } = params;
|
|
11545
11545
|
if (!event)
|
|
11546
11546
|
return { error: MISSING_EVENT };
|
|
11547
11547
|
const { eventId, eventName, endDate, eventType, category, gender, matchUpFormat } = event ?? {};
|
|
@@ -11599,6 +11599,7 @@ function allEventMatchUps(params) {
|
|
|
11599
11599
|
afterRecoveryTimes,
|
|
11600
11600
|
policyDefinitions,
|
|
11601
11601
|
tournamentRecord,
|
|
11602
|
+
usePublishState,
|
|
11602
11603
|
contextFilters,
|
|
11603
11604
|
contextProfile,
|
|
11604
11605
|
drawDefinition,
|
|
@@ -11622,7 +11623,7 @@ function allTournamentMatchUps(params) {
|
|
|
11622
11623
|
if (!params?.tournamentRecord)
|
|
11623
11624
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
11624
11625
|
let { participantMap, participants } = params;
|
|
11625
|
-
const { scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, useParticipantMap, policyDefinitions, tournamentRecord, inContext = true, contextProfile, matchUpFilters, contextFilters, nextMatchUps, context, } = params;
|
|
11626
|
+
const { scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, useParticipantMap, policyDefinitions, tournamentRecord, inContext = true, usePublishState, contextProfile, matchUpFilters, contextFilters, nextMatchUps, context, } = params;
|
|
11626
11627
|
const tournamentId = params.tournamentId ?? tournamentRecord.tournamentId;
|
|
11627
11628
|
const events = tournamentRecord?.events ?? [];
|
|
11628
11629
|
if (!participants) {
|
|
@@ -11661,6 +11662,7 @@ function allTournamentMatchUps(params) {
|
|
|
11661
11662
|
afterRecoveryTimes,
|
|
11662
11663
|
policyDefinitions,
|
|
11663
11664
|
tournamentRecord,
|
|
11665
|
+
usePublishState,
|
|
11664
11666
|
contextContent,
|
|
11665
11667
|
contextFilters,
|
|
11666
11668
|
contextProfile,
|
|
@@ -11676,7 +11678,7 @@ function allTournamentMatchUps(params) {
|
|
|
11676
11678
|
return { matchUps };
|
|
11677
11679
|
}
|
|
11678
11680
|
|
|
11679
|
-
function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecoveryTimes, participantsProfile, tournamentRecords, policyDefinitions, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
11681
|
+
function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecoveryTimes, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
11680
11682
|
if (typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length)
|
|
11681
11683
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
11682
11684
|
const tournamentIds = Object.keys(tournamentRecords);
|
|
@@ -11689,6 +11691,7 @@ function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecoveryTimes,
|
|
|
11689
11691
|
participantsProfile,
|
|
11690
11692
|
policyDefinitions,
|
|
11691
11693
|
tournamentRecord,
|
|
11694
|
+
usePublishState,
|
|
11692
11695
|
matchUpFilters,
|
|
11693
11696
|
contextFilters,
|
|
11694
11697
|
nextMatchUps,
|
|
@@ -28723,7 +28726,7 @@ function generateVoluntaryConsolation(params) {
|
|
|
28723
28726
|
}
|
|
28724
28727
|
|
|
28725
28728
|
function generateScoreString(params) {
|
|
28726
|
-
const { winnerFirst = true, addOutcomeString, reversed = false, matchUpStatus, matchUpFormat, autoComplete, winningSide, sets, } = params;
|
|
28729
|
+
const { winnerFirst = true, setTBlast = true, addOutcomeString, reversed = false, matchUpStatus, matchUpFormat, autoComplete, winningSide, sets, } = params;
|
|
28727
28730
|
if (!sets)
|
|
28728
28731
|
return { error: MISSING_VALUE, info: 'missing sets' };
|
|
28729
28732
|
const parsedFormat = matchUpFormat && parse(matchUpFormat);
|
|
@@ -28746,23 +28749,25 @@ function generateScoreString(params) {
|
|
|
28746
28749
|
const format = isFinalSet && finalSetFormat ? finalSetFormat : setFormat;
|
|
28747
28750
|
const hasGameScores = (set) => isNumeric(set?.side1Score) || isNumeric(set?.side2Score);
|
|
28748
28751
|
const hasTiebreakScores = (set) => isNumeric(set?.side1TiebreakScore) || isNumeric(set?.side2TiebreakScore);
|
|
28749
|
-
const
|
|
28752
|
+
const tbscores = hasTiebreakScores(currentSet);
|
|
28753
|
+
const isTiebreakSet = format?.tiebreakSet || (!hasGameScores(currentSet) && tbscores);
|
|
28750
28754
|
const { side1Score, side2Score, side1TiebreakScore, side2TiebreakScore } = currentSet;
|
|
28751
|
-
const t1 = side1TiebreakScore || (isNumeric(side1TiebreakScore) || autoComplete ? 0 : '');
|
|
28752
|
-
const t2 = side2TiebreakScore || (isNumeric(side2TiebreakScore) || autoComplete ? 0 : '');
|
|
28755
|
+
const t1 = side1TiebreakScore || (isNumeric(side1TiebreakScore) || (tbscores && autoComplete) ? 0 : '');
|
|
28756
|
+
const t2 = side2TiebreakScore || (isNumeric(side2TiebreakScore) || (tbscores && autoComplete) ? 0 : '');
|
|
28753
28757
|
if (isTiebreakSet) {
|
|
28754
28758
|
const tiebreakScore = reverseScores ? [t2, t1] : [t1, t2];
|
|
28755
28759
|
return `[${tiebreakScore.join('-')}]`;
|
|
28756
28760
|
}
|
|
28757
|
-
const lowTiebreakScore = Math.min(t1, t2);
|
|
28761
|
+
const lowTiebreakScore = tbscores ? Math.min(t1, t2) : '';
|
|
28758
28762
|
const lowTiebreakSide = lowTiebreakScore === t1 ? 1 : 2;
|
|
28759
|
-
const tiebreak = lowTiebreakScore ? `(${lowTiebreakScore})` : '';
|
|
28763
|
+
const tiebreak = isNumeric(lowTiebreakScore) ? `(${lowTiebreakScore})` : '';
|
|
28760
28764
|
const s1 = side1Score || (isNumeric(side1Score) || autoComplete ? 0 : '');
|
|
28761
28765
|
const s2 = side2Score || (isNumeric(side2Score) || autoComplete ? 0 : '');
|
|
28762
|
-
const includeTiebreak = (sideNumber) => (lowTiebreakSide === sideNumber ? tiebreak : '');
|
|
28766
|
+
const includeTiebreak = (sideNumber) => (!setTBlast && lowTiebreakSide === sideNumber ? tiebreak : '');
|
|
28763
28767
|
const ss1 = `${s1}${includeTiebreak(1)}`;
|
|
28764
28768
|
const ss2 = `${s2}${includeTiebreak(2)}`;
|
|
28765
|
-
|
|
28769
|
+
const tbLast = setTBlast && tbscores ? `(${lowTiebreakScore})` : '';
|
|
28770
|
+
let scoreString = reverseScores ? `${[ss2, ss1].join('-')}${tbLast}` : `${[ss1, ss2].join('-')}${tbLast}`;
|
|
28766
28771
|
if (['-', ' '].includes(scoreString))
|
|
28767
28772
|
scoreString = '';
|
|
28768
28773
|
return scoreString;
|
|
@@ -28800,10 +28805,12 @@ function reverseScore(params) {
|
|
|
28800
28805
|
setNumber,
|
|
28801
28806
|
});
|
|
28802
28807
|
});
|
|
28803
|
-
const
|
|
28808
|
+
const setTBlast = params?.setTBlast;
|
|
28809
|
+
const scoreStringSide1 = generateScoreString({ setTBlast, sets: reversedSets });
|
|
28804
28810
|
const scoreStringSide2 = generateScoreString({
|
|
28805
28811
|
sets: reversedSets,
|
|
28806
28812
|
reversed: true,
|
|
28813
|
+
setTBlast,
|
|
28807
28814
|
});
|
|
28808
28815
|
return {
|
|
28809
28816
|
reversedScore: { sets: reversedSets, scoreStringSide1, scoreStringSide2 },
|
|
@@ -28896,8 +28903,8 @@ function calculateHistoryScore(params) {
|
|
|
28896
28903
|
tiebreakServingSide = undefined;
|
|
28897
28904
|
sidePoints = [0, 0];
|
|
28898
28905
|
servingSide = 3 - servingSide;
|
|
28899
|
-
set.side1TiebreakScore =
|
|
28900
|
-
set.side2TiebreakScore =
|
|
28906
|
+
set.side1TiebreakScore = '';
|
|
28907
|
+
set.side2TiebreakScore = '';
|
|
28901
28908
|
set.side1PointScore = '';
|
|
28902
28909
|
set.side2PointScore = '';
|
|
28903
28910
|
faults = 0;
|
|
@@ -45523,7 +45530,7 @@ function resetMatchUpLineUps({ inheritance = true, tournamentRecord, drawDefinit
|
|
|
45523
45530
|
}
|
|
45524
45531
|
|
|
45525
45532
|
function matchUpScore(params) {
|
|
45526
|
-
const { matchUpFormat, matchUpStatus, winningSide, score } = params;
|
|
45533
|
+
const { matchUpFormat, matchUpStatus, winningSide, score, setTBlast } = params;
|
|
45527
45534
|
if (!score)
|
|
45528
45535
|
return { sets: [] };
|
|
45529
45536
|
const sets = score.sets || [];
|
|
@@ -45531,6 +45538,7 @@ function matchUpScore(params) {
|
|
|
45531
45538
|
winnerFirst: false,
|
|
45532
45539
|
matchUpFormat,
|
|
45533
45540
|
matchUpStatus,
|
|
45541
|
+
setTBlast,
|
|
45534
45542
|
sets,
|
|
45535
45543
|
});
|
|
45536
45544
|
let scoreStringSide2 = generateScoreString({
|
|
@@ -45538,12 +45546,14 @@ function matchUpScore(params) {
|
|
|
45538
45546
|
reversed: true,
|
|
45539
45547
|
matchUpFormat,
|
|
45540
45548
|
matchUpStatus,
|
|
45549
|
+
setTBlast,
|
|
45541
45550
|
sets,
|
|
45542
45551
|
});
|
|
45543
45552
|
const winnerPerspective = generateScoreString({
|
|
45544
45553
|
matchUpFormat,
|
|
45545
45554
|
matchUpStatus,
|
|
45546
45555
|
winningSide,
|
|
45556
|
+
setTBlast,
|
|
45547
45557
|
sets,
|
|
45548
45558
|
});
|
|
45549
45559
|
const loserPerspective = scoreStringSide1 === winnerPerspective ? scoreStringSide2 : scoreStringSide1;
|
|
@@ -45551,13 +45561,7 @@ function matchUpScore(params) {
|
|
|
45551
45561
|
scoreStringSide1 = winningSide === 1 ? winnerPerspective : loserPerspective;
|
|
45552
45562
|
scoreStringSide2 = winningSide === 2 ? winnerPerspective : loserPerspective;
|
|
45553
45563
|
}
|
|
45554
|
-
return {
|
|
45555
|
-
score: {
|
|
45556
|
-
sets,
|
|
45557
|
-
scoreStringSide1,
|
|
45558
|
-
scoreStringSide2,
|
|
45559
|
-
},
|
|
45560
|
-
};
|
|
45564
|
+
return { score: { sets, scoreStringSide1, scoreStringSide2 } };
|
|
45561
45565
|
}
|
|
45562
45566
|
|
|
45563
45567
|
function setMatchUpStatus(params) {
|
|
@@ -45590,7 +45594,7 @@ function setMatchUpStatus(params) {
|
|
|
45590
45594
|
const allowChangePropagation = (params.allowChangePropagation !== undefined && params.allowChangePropagation) ||
|
|
45591
45595
|
(policy?.allowChangePropagation !== undefined && policy.allowChangePropagation) ||
|
|
45592
45596
|
undefined;
|
|
45593
|
-
const { outcome } = params;
|
|
45597
|
+
const { outcome, setTBlast } = params;
|
|
45594
45598
|
if (outcome?.winningSide && ![1, 2].includes(outcome.winningSide)) {
|
|
45595
45599
|
return { error: INVALID_WINNING_SIDE };
|
|
45596
45600
|
}
|
|
@@ -45606,7 +45610,7 @@ function setMatchUpStatus(params) {
|
|
|
45606
45610
|
return result;
|
|
45607
45611
|
}
|
|
45608
45612
|
if (outcome?.score?.sets && !outcome.score.scoreStringSide1) {
|
|
45609
|
-
const { score: scoreObject } = matchUpScore(outcome);
|
|
45613
|
+
const { score: scoreObject } = matchUpScore({ ...outcome, setTBlast });
|
|
45610
45614
|
outcome.score = scoreObject;
|
|
45611
45615
|
outcome.score.sets = outcome.score.sets.filter((set) => set.side1Score || set.side2Score || set.side1TiebreakScore || set.side2TiebreakScore);
|
|
45612
45616
|
}
|
|
@@ -46337,7 +46341,7 @@ var index$9 = {
|
|
|
46337
46341
|
};
|
|
46338
46342
|
|
|
46339
46343
|
function generateOutcomeFromScoreString(params) {
|
|
46340
|
-
const { matchUpFormat, matchUpStatus, winningSide, scoreString } = params;
|
|
46344
|
+
const { matchUpFormat, matchUpStatus, winningSide, scoreString, setTBlast } = params;
|
|
46341
46345
|
if (!scoreString)
|
|
46342
46346
|
return {
|
|
46343
46347
|
outcome: {
|
|
@@ -46353,11 +46357,13 @@ function generateOutcomeFromScoreString(params) {
|
|
|
46353
46357
|
const winningScoreString = generateScoreString({
|
|
46354
46358
|
sets: neutralParsedSets,
|
|
46355
46359
|
matchUpFormat,
|
|
46360
|
+
setTBlast,
|
|
46356
46361
|
});
|
|
46357
46362
|
const losingScoreString = generateScoreString({
|
|
46358
46363
|
sets: neutralParsedSets,
|
|
46359
46364
|
reversed: true,
|
|
46360
46365
|
matchUpFormat,
|
|
46366
|
+
setTBlast,
|
|
46361
46367
|
});
|
|
46362
46368
|
if (winningSide === 2) {
|
|
46363
46369
|
score.scoreStringSide1 = losingScoreString;
|