tods-competition-factory 2.1.25 → 2.1.27
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 +5 -1
- package/dist/tods-competition-factory.development.cjs.js +43 -29
- 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 +24 -24
|
@@ -2364,6 +2364,7 @@ type GetMatchUpsArgs = {
|
|
|
2364
2364
|
matchUpFilters?: MatchUpFilters;
|
|
2365
2365
|
contextContent?: ContextContent;
|
|
2366
2366
|
participantMap?: ParticipantMap;
|
|
2367
|
+
hydrateParticipants?: boolean;
|
|
2367
2368
|
tournamentRecord?: Tournament;
|
|
2368
2369
|
contextProfile?: ContextProfile;
|
|
2369
2370
|
drawDefinition?: DrawDefinition;
|
|
@@ -5574,6 +5575,7 @@ type CompetitionScheduleMatchUpsArgs = {
|
|
|
5574
5575
|
alwaysReturnCompleted?: boolean;
|
|
5575
5576
|
contextFilters?: MatchUpFilters;
|
|
5576
5577
|
matchUpFilters?: MatchUpFilters;
|
|
5578
|
+
hydrateParticipants?: boolean;
|
|
5577
5579
|
withCourtGridRows?: boolean;
|
|
5578
5580
|
activeTournamentId?: string;
|
|
5579
5581
|
sortDateMatchUps?: boolean;
|
|
@@ -5695,6 +5697,7 @@ type GetAllStructureMatchUps = {
|
|
|
5695
5697
|
matchUpFilters?: MatchUpFilters;
|
|
5696
5698
|
participantMap?: ParticipantMap;
|
|
5697
5699
|
scheduleTiming?: ScheduleTiming;
|
|
5700
|
+
hydrateParticipants?: boolean;
|
|
5698
5701
|
drawDefinition?: DrawDefinition;
|
|
5699
5702
|
contextProfile?: ContextProfile;
|
|
5700
5703
|
tournamentRecord?: Tournament;
|
|
@@ -5767,12 +5770,13 @@ type CompetitionMatchUpsArgs = {
|
|
|
5767
5770
|
policyDefinitions?: PolicyDefinitions;
|
|
5768
5771
|
matchUpFilters?: MatchUpFilters;
|
|
5769
5772
|
contextFilters?: MatchUpFilters;
|
|
5773
|
+
hydrateParticipants?: boolean;
|
|
5770
5774
|
afterRecoveryTimes?: boolean;
|
|
5771
5775
|
usePublishState?: boolean;
|
|
5772
5776
|
nextMatchUps?: boolean;
|
|
5773
5777
|
inContext?: boolean;
|
|
5774
5778
|
};
|
|
5775
|
-
declare function getCompetitionMatchUps({ scheduleVisibilityFilters, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs): ResultType & {
|
|
5779
|
+
declare function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs): ResultType & {
|
|
5776
5780
|
abandonedMatchUps?: HydratedMatchUp[];
|
|
5777
5781
|
completedMatchUps?: HydratedMatchUp[];
|
|
5778
5782
|
upcomingMatchUps?: HydratedMatchUp[];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.1.
|
|
6
|
+
return '2.1.27';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -10177,7 +10177,7 @@ function getSeeding({ seedAssignments, participantId }) {
|
|
|
10177
10177
|
return seedAssignments?.find((assignment) => !assignment.seedProxy && assignment.participantId === participantId);
|
|
10178
10178
|
}
|
|
10179
10179
|
|
|
10180
|
-
function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges, tournamentParticipants, positionAssignments, drawPositionsRanges, afterRecoveryTimes, initialRoundOfPlay, additionalContext, roundNamingProfile, tournamentRecord, tieDrawPositions, appliedPolicies, isCollectionBye, seedAssignments, usePublishState, participantMap, contextContent, scheduleTiming, contextProfile, drawDefinition, publishStatus, scoringActive, matchUpTieId, isRoundRobin, roundProfile, sideLineUps, structure, context, matchUp, event, }) {
|
|
10180
|
+
function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges, tournamentParticipants, positionAssignments, drawPositionsRanges, hydrateParticipants, afterRecoveryTimes, initialRoundOfPlay, additionalContext, roundNamingProfile, tournamentRecord, tieDrawPositions, appliedPolicies, isCollectionBye, seedAssignments, usePublishState, participantMap, contextContent, scheduleTiming, contextProfile, drawDefinition, publishStatus, scoringActive, matchUpTieId, isRoundRobin, roundProfile, sideLineUps, structure, context, matchUp, event, }) {
|
|
10181
10181
|
additionalContext = additionalContext ?? {};
|
|
10182
10182
|
const tieFormat = resolveTieFormat({
|
|
10183
10183
|
drawDefinition,
|
|
@@ -10339,7 +10339,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10339
10339
|
});
|
|
10340
10340
|
Object.assign(matchUpWithContext, makeDeepCopy({ sides }, true, true));
|
|
10341
10341
|
}
|
|
10342
|
-
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
10342
|
+
if (tournamentParticipants && matchUpWithContext.sides && hydrateParticipants !== false) {
|
|
10343
10343
|
const participantAttributes = appliedPolicies?.[POLICY_TYPE_PARTICIPANT];
|
|
10344
10344
|
const getMappedParticipant = (participantId) => {
|
|
10345
10345
|
const participant = participantMap?.[participantId]?.participant;
|
|
@@ -10707,10 +10707,8 @@ function getAllStructureMatchUps(params) {
|
|
|
10707
10707
|
...params.policyDefinitions,
|
|
10708
10708
|
};
|
|
10709
10709
|
const structureScoringPolicies = appliedPolicies?.scoring?.structures;
|
|
10710
|
-
const stageSpecificPolicies = structure.stage && structureScoringPolicies?.stage
|
|
10711
|
-
const sequenceSpecificPolicies = structure.stageSequence &&
|
|
10712
|
-
stageSpecificPolicies?.stageSequence &&
|
|
10713
|
-
stageSpecificPolicies.stageSequence[structure.stageSequence];
|
|
10710
|
+
const stageSpecificPolicies = structure.stage && structureScoringPolicies?.stage?.[structure.stage];
|
|
10711
|
+
const sequenceSpecificPolicies = structure.stageSequence && stageSpecificPolicies?.stageSequence?.[structure.stageSequence];
|
|
10714
10712
|
const requireAllPositionsAssigned = appliedPolicies?.scoring?.requireAllPositionsAssigned ||
|
|
10715
10713
|
stageSpecificPolicies?.requireAllPositionsAssigned ||
|
|
10716
10714
|
sequenceSpecificPolicies?.requireAllPositionsAssigned;
|
|
@@ -10775,6 +10773,7 @@ function getAllStructureMatchUps(params) {
|
|
|
10775
10773
|
return addMatchUpContext({
|
|
10776
10774
|
tournamentParticipants: params.tournamentParticipants ?? tournamentRecord?.participants,
|
|
10777
10775
|
scheduleVisibilityFilters: params.scheduleVisibilityFilters,
|
|
10776
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
10778
10777
|
afterRecoveryTimes: params.afterRecoveryTimes,
|
|
10779
10778
|
usePublishState: params.usePublishState,
|
|
10780
10779
|
participantMap: params.participantMap,
|
|
@@ -10859,7 +10858,7 @@ function checkMatchUpIsComplete({ matchUp }) {
|
|
|
10859
10858
|
return completedMatchUpStatuses.includes(matchUp?.matchUpStatus) || matchUp?.winningSide;
|
|
10860
10859
|
}
|
|
10861
10860
|
|
|
10862
|
-
function getStructureMatchUps({ requireParticipants = true, scheduleVisibilityFilters, tournamentAppliedPolicies, tournamentParticipants, afterRecoveryTimes, policyDefinitions, tournamentRecord, usePublishState, matchUpFilters, contextFilters, contextContent, participantMap, scheduleTiming, publishStatus, contextProfile, drawDefinition, exitProfiles, matchUpsMap, structureId, inContext, structure, context, event, }) {
|
|
10861
|
+
function getStructureMatchUps({ requireParticipants = true, scheduleVisibilityFilters, tournamentAppliedPolicies, tournamentParticipants, hydrateParticipants, afterRecoveryTimes, policyDefinitions, tournamentRecord, usePublishState, matchUpFilters, contextFilters, contextContent, participantMap, scheduleTiming, publishStatus, contextProfile, drawDefinition, exitProfiles, matchUpsMap, structureId, inContext, structure, context, event, }) {
|
|
10863
10862
|
if (!structure && structureId) {
|
|
10864
10863
|
({ structure } = findStructure({ drawDefinition, structureId }));
|
|
10865
10864
|
}
|
|
@@ -10867,6 +10866,7 @@ function getStructureMatchUps({ requireParticipants = true, scheduleVisibilityFi
|
|
|
10867
10866
|
tournamentAppliedPolicies,
|
|
10868
10867
|
scheduleVisibilityFilters,
|
|
10869
10868
|
tournamentParticipants,
|
|
10869
|
+
hydrateParticipants,
|
|
10870
10870
|
afterRecoveryTimes,
|
|
10871
10871
|
policyDefinitions,
|
|
10872
10872
|
tournamentRecord,
|
|
@@ -11440,6 +11440,7 @@ function getDrawMatchUps(params) {
|
|
|
11440
11440
|
matchUpFilters: !nextMatchUps ? matchUpFilters : undefined,
|
|
11441
11441
|
contextFilters: !nextMatchUps ? contextFilters : undefined,
|
|
11442
11442
|
inContext: inContext || nextMatchUps || contextFilters,
|
|
11443
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
11443
11444
|
tournamentAppliedPolicies,
|
|
11444
11445
|
scheduleVisibilityFilters,
|
|
11445
11446
|
tournamentParticipants,
|
|
@@ -36432,6 +36433,7 @@ function eventMatchUps(params) {
|
|
|
36432
36433
|
const drawDefinitions = event.drawDefinitions ?? [];
|
|
36433
36434
|
const eventResult = drawDefinitions.reduce((results, drawDefinition) => {
|
|
36434
36435
|
const drawMatchUpsResult = getDrawMatchUps({
|
|
36436
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
36435
36437
|
context: additionalContext,
|
|
36436
36438
|
tournamentAppliedPolicies,
|
|
36437
36439
|
scheduleVisibilityFilters,
|
|
@@ -36499,6 +36501,7 @@ function tournamentMatchUps(params) {
|
|
|
36499
36501
|
...context,
|
|
36500
36502
|
};
|
|
36501
36503
|
return eventMatchUps({
|
|
36504
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
36502
36505
|
context: additionalContext,
|
|
36503
36506
|
tournamentAppliedPolicies,
|
|
36504
36507
|
scheduleVisibilityFilters,
|
|
@@ -36534,7 +36537,7 @@ function tournamentMatchUps(params) {
|
|
|
36534
36537
|
return { ...eventsDrawMatchUpsResult, groupInfo };
|
|
36535
36538
|
}
|
|
36536
36539
|
|
|
36537
|
-
function getCompetitionMatchUps({ scheduleVisibilityFilters, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
36540
|
+
function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
36538
36541
|
if (typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length)
|
|
36539
36542
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
36540
36543
|
const tournamentIds = Object.keys(tournamentRecords);
|
|
@@ -36542,6 +36545,7 @@ function getCompetitionMatchUps({ scheduleVisibilityFilters, participantsProfile
|
|
|
36542
36545
|
const tournamentRecord = tournamentRecords[tournamentId];
|
|
36543
36546
|
return tournamentMatchUps({
|
|
36544
36547
|
scheduleVisibilityFilters,
|
|
36548
|
+
hydrateParticipants,
|
|
36545
36549
|
participantsProfile,
|
|
36546
36550
|
policyDefinitions,
|
|
36547
36551
|
tournamentRecord,
|
|
@@ -44057,8 +44061,11 @@ function noDownstreamDependencies(params) {
|
|
|
44057
44061
|
return decorateResult({ result, stack });
|
|
44058
44062
|
}
|
|
44059
44063
|
function scoreModification(params) {
|
|
44060
|
-
const stack = 'scoreModification';
|
|
44061
|
-
const remove = params.isCollectionMatchUp &&
|
|
44064
|
+
const stack = 'ndd:scoreModification';
|
|
44065
|
+
const remove = params.isCollectionMatchUp &&
|
|
44066
|
+
params.dualMatchUp?.winningSide &&
|
|
44067
|
+
!params.projectedWinningSide &&
|
|
44068
|
+
!params.autoCalcDisabled;
|
|
44062
44069
|
if (remove) {
|
|
44063
44070
|
const result = removeDirectedParticipants(params);
|
|
44064
44071
|
if (result.error)
|
|
@@ -44912,6 +44919,22 @@ function setMatchUpState(params) {
|
|
|
44912
44919
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
44913
44920
|
const isTeam = isMatchUpEventType(TEAM$2)(matchUp.matchUpType);
|
|
44914
44921
|
const assignedDrawPositions = inContextMatchUp?.drawPositions?.filter(Boolean);
|
|
44922
|
+
const matchUpTieId = inContextMatchUp?.matchUpTieId;
|
|
44923
|
+
const targetData = positionTargets({
|
|
44924
|
+
matchUpId: matchUpTieId || matchUpId,
|
|
44925
|
+
inContextDrawMatchUps,
|
|
44926
|
+
drawDefinition,
|
|
44927
|
+
});
|
|
44928
|
+
Object.assign(params, {
|
|
44929
|
+
inContextDrawMatchUps,
|
|
44930
|
+
inContextMatchUp,
|
|
44931
|
+
matchUpTieId,
|
|
44932
|
+
matchUpsMap,
|
|
44933
|
+
targetData,
|
|
44934
|
+
structure,
|
|
44935
|
+
matchUp,
|
|
44936
|
+
});
|
|
44937
|
+
const activeDownstream = isActiveDownstream(params);
|
|
44915
44938
|
let dualWinningSideChange;
|
|
44916
44939
|
if (isTeam) {
|
|
44917
44940
|
if (disableAutoCalc) {
|
|
@@ -44922,7 +44945,6 @@ function setMatchUpState(params) {
|
|
|
44922
44945
|
}
|
|
44923
44946
|
else if (enableAutoCalc) {
|
|
44924
44947
|
const existingDualMatchUpWinningSide = matchUp.winningSide;
|
|
44925
|
-
removeExtension({ name: DISABLE_AUTO_CALC, element: matchUp });
|
|
44926
44948
|
const { winningSide: projectedWinningSide, scoreStringSide1, scoreStringSide2, set, } = generateTieMatchUpScore({
|
|
44927
44949
|
drawDefinition,
|
|
44928
44950
|
matchUpsMap,
|
|
@@ -44936,6 +44958,14 @@ function setMatchUpState(params) {
|
|
|
44936
44958
|
sets: set ? [set] : [],
|
|
44937
44959
|
};
|
|
44938
44960
|
dualWinningSideChange = projectedWinningSide !== existingDualMatchUpWinningSide;
|
|
44961
|
+
if (activeDownstream && dualWinningSideChange) {
|
|
44962
|
+
return decorateResult({
|
|
44963
|
+
stack: 'winningSideWithDownstreamDependencies',
|
|
44964
|
+
result: { error: CANNOT_CHANGE_WINNING_SIDE },
|
|
44965
|
+
context: { winningSide, matchUp },
|
|
44966
|
+
});
|
|
44967
|
+
}
|
|
44968
|
+
removeExtension({ name: DISABLE_AUTO_CALC, element: matchUp });
|
|
44939
44969
|
Object.assign(params, {
|
|
44940
44970
|
winningSide: projectedWinningSide,
|
|
44941
44971
|
dualWinningSideChange,
|
|
@@ -44961,12 +44991,6 @@ function setMatchUpState(params) {
|
|
|
44961
44991
|
error: INVALID_VALUES,
|
|
44962
44992
|
};
|
|
44963
44993
|
}
|
|
44964
|
-
const matchUpTieId = inContextMatchUp?.matchUpTieId;
|
|
44965
|
-
const targetData = positionTargets({
|
|
44966
|
-
matchUpId: matchUpTieId || matchUpId,
|
|
44967
|
-
inContextDrawMatchUps,
|
|
44968
|
-
drawDefinition,
|
|
44969
|
-
});
|
|
44970
44994
|
if (score && !isTeam && !disableScoreValidation) {
|
|
44971
44995
|
const matchUpFormat = matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
44972
44996
|
const result = validateScore({
|
|
@@ -45013,17 +45037,10 @@ function setMatchUpState(params) {
|
|
|
45013
45037
|
winningSide !== matchUp.winningSide &&
|
|
45014
45038
|
matchUp.winningSide;
|
|
45015
45039
|
Object.assign(params, {
|
|
45016
|
-
inContextDrawMatchUps,
|
|
45017
45040
|
qualifierAdvancing,
|
|
45018
45041
|
qualifierChanging,
|
|
45019
45042
|
removingQualifier,
|
|
45020
|
-
inContextMatchUp,
|
|
45021
45043
|
appliedPolicies,
|
|
45022
|
-
matchUpTieId,
|
|
45023
|
-
matchUpsMap,
|
|
45024
|
-
targetData,
|
|
45025
|
-
structure,
|
|
45026
|
-
matchUp,
|
|
45027
45044
|
});
|
|
45028
45045
|
if (matchUpTieId) {
|
|
45029
45046
|
const { matchUp: dualMatchUp } = findDrawMatchUp({
|
|
@@ -45067,7 +45084,6 @@ function setMatchUpState(params) {
|
|
|
45067
45084
|
}
|
|
45068
45085
|
}
|
|
45069
45086
|
const directingMatchUpStatus = isDirectingMatchUpStatus({ matchUpStatus });
|
|
45070
|
-
const activeDownstream = isActiveDownstream(params);
|
|
45071
45087
|
if (!matchUpTieId) {
|
|
45072
45088
|
if (activeDownstream &&
|
|
45073
45089
|
!winningSide &&
|
|
@@ -49660,9 +49676,7 @@ function completeDrawMatchUps(params) {
|
|
|
49660
49676
|
structure,
|
|
49661
49677
|
event,
|
|
49662
49678
|
}).matchUps;
|
|
49663
|
-
if (!matchUps.length)
|
|
49664
|
-
console.log('##', drawDefinition);
|
|
49665
|
-
}
|
|
49679
|
+
if (!matchUps.length) ;
|
|
49666
49680
|
const sortedMatchUpIds = matchUps
|
|
49667
49681
|
.filter(({ winningSide }) => !winningSide)
|
|
49668
49682
|
.sort(matchUpSort)
|