tods-competition-factory 2.0.55 → 2.0.57

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.55';
6
+ return '2.0.57';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1823,6 +1823,7 @@ const PARTICIPANT_ID = 'participantId';
1823
1823
  const SCHEDULE_DATES = 'scheduleDates';
1824
1824
  const TOURNAMENT_ID = 'tournamentId';
1825
1825
  const SCHEDULE_DATE = 'scheduleDate';
1826
+ const ROUND_NUMBER = 'roundNumber';
1826
1827
  const STRUCTURE_ID = 'structureId';
1827
1828
  const PARTICIPANT = 'participant';
1828
1829
  const MATCHUP_IDS = 'matchUpIds';
@@ -1915,8 +1916,8 @@ function checkRequiredParameters(params, requiredParams, stack) {
1915
1916
  if (!paramError)
1916
1917
  return { valid: true };
1917
1918
  const error = params?.[errorParam] === undefined
1918
- ? errors[errorParam] || paramError[ERROR] || INVALID_VALUES
1919
- : (paramError[VALIDATE] && paramError[INVALID]) || INVALID_VALUES;
1919
+ ? errors[errorParam] || paramError[ERROR] || paramError[INVALID] || INVALID_VALUES
1920
+ : (paramError[VALIDATE] && (paramError[ERROR] || paramError[INVALID])) || INVALID_VALUES;
1920
1921
  const param = errorParam ?? (paramError[ONE_OF] && Object.keys(paramError[ONE_OF]).join(', '));
1921
1922
  return decorateResult({
1922
1923
  info: { param, message: paramError[MESSAGE] },
@@ -15562,250 +15563,6 @@ function qualifierDrawPositionAssignment(params) {
15562
15563
  return qualifierDrawPositionAssignment$1(params);
15563
15564
  }
15564
15565
 
15565
- function swapDrawPositionAssignments$1({ tournamentRecord, drawDefinition, drawPositions, structureId, event }) {
15566
- if (!drawDefinition)
15567
- return { error: MISSING_DRAW_DEFINITION };
15568
- if (!structureId)
15569
- return { error: MISSING_STRUCTURE_ID };
15570
- if (drawPositions?.length !== 2)
15571
- return { error: INVALID_VALUES, drawPositions };
15572
- const matchUpsMap = getMatchUpsMap({ drawDefinition });
15573
- const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
15574
- inContext: true,
15575
- drawDefinition,
15576
- matchUpsMap,
15577
- });
15578
- const { structure } = findStructure({ drawDefinition, structureId });
15579
- if (!structure)
15580
- return { error: STRUCTURE_NOT_FOUND };
15581
- const appliedPolicies = getAppliedPolicies({
15582
- tournamentRecord,
15583
- drawDefinition,
15584
- event,
15585
- }).appliedPolicies ?? {};
15586
- let result;
15587
- if (structure.structureType === CONTAINER) {
15588
- result = roundRobinSwap({
15589
- inContextDrawMatchUps,
15590
- tournamentRecord,
15591
- drawDefinition,
15592
- drawPositions,
15593
- matchUpsMap,
15594
- structure,
15595
- event,
15596
- });
15597
- }
15598
- else {
15599
- result = eliminationSwap({
15600
- inContextDrawMatchUps,
15601
- tournamentRecord,
15602
- drawDefinition,
15603
- drawPositions,
15604
- matchUpsMap,
15605
- structure,
15606
- event,
15607
- });
15608
- }
15609
- if (result.error)
15610
- return result;
15611
- conditionallyDisableLinkPositioning({ structure, drawPositions });
15612
- const positionAction = {
15613
- name: 'swapDrawPositionAssignments',
15614
- drawPositions,
15615
- structureId,
15616
- };
15617
- addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
15618
- modifyPositionAssignmentsNotice({
15619
- tournamentId: tournamentRecord?.tournamentId,
15620
- drawDefinition,
15621
- structure,
15622
- event,
15623
- });
15624
- if (event.eventType === TEAM_EVENT) {
15625
- const inContextTargetMatchUps = getAllStructureMatchUps({
15626
- matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
15627
- inContext: true,
15628
- structure,
15629
- }).matchUps.filter((matchUp) => matchUp.drawPositions?.some((drawPosition) => drawPositions.includes(drawPosition)));
15630
- const structureMatchUps = getAllStructureMatchUps({
15631
- matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
15632
- structure,
15633
- }).matchUps;
15634
- inContextTargetMatchUps.forEach((inContextTargetMatchUp) => {
15635
- (inContextTargetMatchUp.sides || []).forEach((inContextSide) => {
15636
- const drawPosition = inContextSide?.drawPosition;
15637
- if (drawPositions.includes(drawPosition)) {
15638
- const teamParticipantId = inContextSide.participantId;
15639
- const matchUp = structureMatchUps.find(({ matchUpId }) => matchUpId === inContextTargetMatchUp.matchUpId);
15640
- const drawPositionSideIndex = inContextTargetMatchUp?.sides?.reduce((index, side, i) => (side.drawPosition === drawPosition ? i : index), undefined);
15641
- updateSideLineUp({
15642
- inContextTargetMatchUp,
15643
- drawPositionSideIndex,
15644
- teamParticipantId,
15645
- tournamentRecord,
15646
- drawDefinition,
15647
- matchUp,
15648
- event,
15649
- });
15650
- }
15651
- });
15652
- });
15653
- }
15654
- modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
15655
- return { ...SUCCESS };
15656
- }
15657
- function eliminationSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
15658
- const assignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
15659
- if (!assignments) {
15660
- return {
15661
- error: INVALID_VALUES,
15662
- structure,
15663
- info: 'Missing positionAssignments',
15664
- };
15665
- }
15666
- if (assignments.filter(({ bye }) => bye).length === 2)
15667
- return { ...SUCCESS };
15668
- if (assignments.filter(({ qualifier }) => qualifier).length === 2)
15669
- return { ...SUCCESS };
15670
- const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
15671
- const isByeSwap = assignments.some(({ bye }) => bye);
15672
- if (isByeSwap && !isQualifierSwap) {
15673
- return swapParticipantIdWithBYE({
15674
- inContextDrawMatchUps,
15675
- tournamentRecord,
15676
- drawDefinition,
15677
- assignments,
15678
- matchUpsMap,
15679
- structure,
15680
- event,
15681
- });
15682
- }
15683
- else {
15684
- return eliminationPosiitonSwap({
15685
- inContextDrawMatchUps,
15686
- tournamentRecord,
15687
- drawDefinition,
15688
- assignments,
15689
- matchUpsMap,
15690
- structure,
15691
- event,
15692
- });
15693
- }
15694
- }
15695
- function swapParticipantIdWithBYE({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
15696
- const originalByeAssignment = assignments.find(({ bye }) => bye);
15697
- const originalParticipantIdAssignment = assignments.find(({ participantId }) => participantId);
15698
- const originalByeDrawPosition = originalByeAssignment.drawPosition;
15699
- const { participantId, drawPosition: originalParticipantIdDrawPosition } = originalParticipantIdAssignment;
15700
- const { structureId } = structure;
15701
- let result = removeDrawPositionAssignment({
15702
- drawPosition: originalByeDrawPosition,
15703
- inContextDrawMatchUps,
15704
- tournamentRecord,
15705
- drawDefinition,
15706
- structureId,
15707
- matchUpsMap,
15708
- });
15709
- if (result.error)
15710
- return result;
15711
- result = removeDrawPositionAssignment({
15712
- drawPosition: originalParticipantIdDrawPosition,
15713
- inContextDrawMatchUps,
15714
- tournamentRecord,
15715
- drawDefinition,
15716
- structureId,
15717
- matchUpsMap,
15718
- });
15719
- if (result.error)
15720
- return result;
15721
- assignDrawPositionBye({
15722
- drawPosition: originalParticipantIdDrawPosition,
15723
- tournamentRecord,
15724
- drawDefinition,
15725
- structureId,
15726
- matchUpsMap,
15727
- event,
15728
- });
15729
- result = assignDrawPosition$1({
15730
- drawPosition: originalByeDrawPosition,
15731
- inContextDrawMatchUps,
15732
- tournamentRecord,
15733
- drawDefinition,
15734
- structureId,
15735
- participantId,
15736
- matchUpsMap,
15737
- event,
15738
- });
15739
- if (result.error)
15740
- return result;
15741
- return { ...SUCCESS };
15742
- }
15743
- function eliminationPosiitonSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
15744
- const newAssignments = Object.assign({}, ...assignments.map((assignment, index) => {
15745
- const { drawPosition } = assignment;
15746
- const newAssignment = { ...assignments[1 - index], drawPosition };
15747
- return { [drawPosition]: newAssignment };
15748
- }));
15749
- structure.positionAssignments = structure.positionAssignments.map((assignment) => newAssignments[assignment.drawPosition] || assignment);
15750
- resetLineUps({
15751
- inContextDrawMatchUps,
15752
- tournamentRecord,
15753
- drawDefinition,
15754
- matchUpsMap,
15755
- assignments,
15756
- structure,
15757
- event,
15758
- });
15759
- return { ...SUCCESS };
15760
- }
15761
- function roundRobinSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
15762
- const assignments = structure.structures?.reduce((assignments, structure) => {
15763
- const structureAssignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
15764
- if (structureAssignments)
15765
- assignments.push(...structureAssignments);
15766
- return assignments;
15767
- }, []);
15768
- if (assignments.filter(({ bye }) => bye).length === 2)
15769
- return { ...SUCCESS };
15770
- if (assignments.filter(({ qualifier }) => qualifier).length === 2)
15771
- return { ...SUCCESS };
15772
- resetLineUps({
15773
- inContextDrawMatchUps,
15774
- tournamentRecord,
15775
- drawDefinition,
15776
- matchUpsMap,
15777
- assignments,
15778
- structure,
15779
- event,
15780
- });
15781
- const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
15782
- const isByeSwap = assignments.some(({ bye }) => bye);
15783
- if (isByeSwap && !isQualifierSwap) {
15784
- swapParticipantIdWithBYE({
15785
- inContextDrawMatchUps,
15786
- tournamentRecord,
15787
- drawDefinition,
15788
- assignments,
15789
- matchUpsMap,
15790
- structure,
15791
- event,
15792
- });
15793
- }
15794
- else {
15795
- const originalAssignments = makeDeepCopy(assignments, false, true);
15796
- assignments.forEach((assignment, index) => {
15797
- const newParticipantId = originalAssignments[1 - index].participantId;
15798
- assignment.qualifier = originalAssignments[1 - index].qualifier;
15799
- assignment.participantId = newParticipantId;
15800
- });
15801
- }
15802
- return { ...SUCCESS };
15803
- }
15804
-
15805
- function swapDrawPositionAssignments(params) {
15806
- return swapDrawPositionAssignments$1(params);
15807
- }
15808
-
15809
15566
  function modifySeedAssignment({ validation = true, tournamentRecord, drawDefinition, participantId, structureId, seedValue, event, }) {
15810
15567
  if (!drawDefinition)
15811
15568
  return { error: MISSING_DRAW_DEFINITION };
@@ -17894,8 +17651,14 @@ function renameStructures({ drawDefinition, structureDetails }) {
17894
17651
  }
17895
17652
  for (const structure of drawDefinition.structures || []) {
17896
17653
  const structureName = detailMap[structure.structureId];
17897
- if (structureName) {
17654
+ if (structureName)
17898
17655
  structure.structureName = structureName;
17656
+ if (structure.structures) {
17657
+ for (const subStructure of structure.structures) {
17658
+ const subStructureName = detailMap[subStructure.structureId];
17659
+ if (subStructureName)
17660
+ subStructure.structureName = subStructureName;
17661
+ }
17899
17662
  }
17900
17663
  }
17901
17664
  return { ...SUCCESS };
@@ -18157,6 +17920,289 @@ function addVoluntaryConsolationStage(params) {
18157
17920
  return addVoluntaryConsolationStage$1(params);
18158
17921
  }
18159
17922
 
17923
+ const QUALIFYING_PARTICIPANT_METHOD = 'qualifierDrawPositionAssignment';
17924
+ const WITHDRAW_PARTICIPANT_METHOD = 'withdrawParticipantAtDrawPosition';
17925
+ const ALTERNATE_PARTICIPANT_METHOD = 'alternateDrawPositionAssignment';
17926
+ const LUCKY_PARTICIPANT_METHOD = 'luckyLoserDrawPositionAssignment';
17927
+ const REMOVE_ASSIGNMENT_METHOD = 'removeDrawPositionAssignment';
17928
+ const SWAP_PARTICIPANT_METHOD = 'swapDrawPositionAssignments';
17929
+ const MODIFY_PAIR_ASSIGNMENT_METHOD = 'modifyPairAssignment';
17930
+ const SWAP_ADHOC_PARTICIPANT_METHOD = 'adHocPositionSwap';
17931
+ const ADD_NICKNAME_METHOD = 'modifyParticipantOtherName';
17932
+ const ASSIGN_PARTICIPANT_METHOD = 'assignDrawPosition';
17933
+ const REMOVE_SEED_METHOD = 'removeSeededParticipant';
17934
+ const ASSIGN_BYE_METHOD = 'assignDrawPositionBye';
17935
+ const SEED_VALUE_METHOD = 'modifySeedAssignment';
17936
+ const ADD_PENALTY_METHOD = 'addPenalty';
17937
+ const MODIFY_PAIR_ASSIGNMENT = 'MODIFY_PAIR';
17938
+ const QUALIFYING_PARTICIPANT = 'QUALIFIER';
17939
+ const ALTERNATE_PARTICIPANT = 'ALTERNATE';
17940
+ const WITHDRAW_PARTICIPANT = 'WITHDRAW';
17941
+ const ASSIGN_PARTICIPANT = 'ASSIGN';
17942
+ const REMOVE_ASSIGNMENT = 'REMOVE';
17943
+ const LUCKY_PARTICIPANT = 'LUCKY';
17944
+ const REMOVE_SEED = 'REMOVE_SEED';
17945
+ const SWAP_PARTICIPANTS = 'SWAP';
17946
+ const ADD_NICKNAME = 'NICKNAME';
17947
+ const SEED_VALUE = 'SEED_VALUE';
17948
+ const ADD_PENALTY = 'PENALTY';
17949
+ const ASSIGN_BYE = 'BYE';
17950
+ const positionActionConstants = {
17951
+ MODIFY_PAIR_ASSIGNMENT,
17952
+ QUALIFYING_PARTICIPANT,
17953
+ ALTERNATE_PARTICIPANT,
17954
+ WITHDRAW_PARTICIPANT,
17955
+ ASSIGN_PARTICIPANT,
17956
+ LUCKY_PARTICIPANT,
17957
+ REMOVE_ASSIGNMENT,
17958
+ SWAP_PARTICIPANTS,
17959
+ ADD_NICKNAME,
17960
+ REMOVE_SEED,
17961
+ ADD_PENALTY,
17962
+ ASSIGN_BYE,
17963
+ SEED_VALUE,
17964
+ };
17965
+
17966
+ function swapDrawPositionAssignments({ tournamentRecord, drawDefinition, drawPositions, structureId, event }) {
17967
+ if (!drawDefinition)
17968
+ return { error: MISSING_DRAW_DEFINITION };
17969
+ if (!structureId)
17970
+ return { error: MISSING_STRUCTURE_ID };
17971
+ if (drawPositions?.length !== 2)
17972
+ return { error: INVALID_VALUES, drawPositions };
17973
+ const matchUpsMap = getMatchUpsMap({ drawDefinition });
17974
+ const { matchUps: inContextDrawMatchUps } = getAllDrawMatchUps({
17975
+ inContext: true,
17976
+ drawDefinition,
17977
+ matchUpsMap,
17978
+ });
17979
+ const { structure } = findStructure({ drawDefinition, structureId });
17980
+ if (!structure)
17981
+ return { error: STRUCTURE_NOT_FOUND };
17982
+ const appliedPolicies = getAppliedPolicies({
17983
+ tournamentRecord,
17984
+ drawDefinition,
17985
+ event,
17986
+ }).appliedPolicies ?? {};
17987
+ let result;
17988
+ if (structure.structureType === CONTAINER) {
17989
+ result = roundRobinSwap({
17990
+ inContextDrawMatchUps,
17991
+ tournamentRecord,
17992
+ drawDefinition,
17993
+ drawPositions,
17994
+ matchUpsMap,
17995
+ structure,
17996
+ event,
17997
+ });
17998
+ }
17999
+ else {
18000
+ result = eliminationSwap({
18001
+ inContextDrawMatchUps,
18002
+ tournamentRecord,
18003
+ drawDefinition,
18004
+ drawPositions,
18005
+ matchUpsMap,
18006
+ structure,
18007
+ event,
18008
+ });
18009
+ }
18010
+ if (result.error)
18011
+ return result;
18012
+ conditionallyDisableLinkPositioning({ structure, drawPositions });
18013
+ const positionAction = {
18014
+ name: SWAP_PARTICIPANT_METHOD,
18015
+ drawPositions,
18016
+ structureId,
18017
+ };
18018
+ addPositionActionTelemetry({ appliedPolicies, drawDefinition, positionAction });
18019
+ modifyPositionAssignmentsNotice({
18020
+ tournamentId: tournamentRecord?.tournamentId,
18021
+ drawDefinition,
18022
+ structure,
18023
+ event,
18024
+ });
18025
+ if (event.eventType === TEAM_EVENT) {
18026
+ const inContextTargetMatchUps = getAllStructureMatchUps({
18027
+ matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
18028
+ inContext: true,
18029
+ structure,
18030
+ }).matchUps.filter((matchUp) => matchUp.drawPositions?.some((drawPosition) => drawPositions.includes(drawPosition)));
18031
+ const structureMatchUps = getAllStructureMatchUps({
18032
+ matchUpFilters: { matchUpTypes: [TEAM_MATCHUP] },
18033
+ structure,
18034
+ }).matchUps;
18035
+ inContextTargetMatchUps.forEach((inContextTargetMatchUp) => {
18036
+ (inContextTargetMatchUp.sides || []).forEach((inContextSide) => {
18037
+ const drawPosition = inContextSide?.drawPosition;
18038
+ if (drawPositions.includes(drawPosition)) {
18039
+ const teamParticipantId = inContextSide.participantId;
18040
+ const matchUp = structureMatchUps.find(({ matchUpId }) => matchUpId === inContextTargetMatchUp.matchUpId);
18041
+ const drawPositionSideIndex = inContextTargetMatchUp?.sides?.reduce((index, side, i) => (side.drawPosition === drawPosition ? i : index), undefined);
18042
+ updateSideLineUp({
18043
+ inContextTargetMatchUp,
18044
+ drawPositionSideIndex,
18045
+ teamParticipantId,
18046
+ tournamentRecord,
18047
+ drawDefinition,
18048
+ matchUp,
18049
+ event,
18050
+ });
18051
+ }
18052
+ });
18053
+ });
18054
+ }
18055
+ modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
18056
+ return { ...SUCCESS };
18057
+ }
18058
+ function eliminationSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
18059
+ const assignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
18060
+ if (!assignments) {
18061
+ return {
18062
+ error: INVALID_VALUES,
18063
+ structure,
18064
+ info: 'Missing positionAssignments',
18065
+ };
18066
+ }
18067
+ if (assignments.filter(({ bye }) => bye).length === 2)
18068
+ return { ...SUCCESS };
18069
+ if (assignments.filter(({ qualifier }) => qualifier).length === 2)
18070
+ return { ...SUCCESS };
18071
+ const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
18072
+ const isByeSwap = assignments.some(({ bye }) => bye);
18073
+ if (isByeSwap && !isQualifierSwap) {
18074
+ return swapParticipantIdWithBYE({
18075
+ inContextDrawMatchUps,
18076
+ tournamentRecord,
18077
+ drawDefinition,
18078
+ assignments,
18079
+ matchUpsMap,
18080
+ structure,
18081
+ event,
18082
+ });
18083
+ }
18084
+ else {
18085
+ return eliminationPosiitonSwap({
18086
+ inContextDrawMatchUps,
18087
+ tournamentRecord,
18088
+ drawDefinition,
18089
+ assignments,
18090
+ matchUpsMap,
18091
+ structure,
18092
+ event,
18093
+ });
18094
+ }
18095
+ }
18096
+ function swapParticipantIdWithBYE({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
18097
+ const originalByeAssignment = assignments.find(({ bye }) => bye);
18098
+ const originalParticipantIdAssignment = assignments.find(({ participantId }) => participantId);
18099
+ const originalByeDrawPosition = originalByeAssignment.drawPosition;
18100
+ const { participantId, drawPosition: originalParticipantIdDrawPosition } = originalParticipantIdAssignment;
18101
+ const { structureId } = structure;
18102
+ let result = removeDrawPositionAssignment({
18103
+ drawPosition: originalByeDrawPosition,
18104
+ inContextDrawMatchUps,
18105
+ tournamentRecord,
18106
+ drawDefinition,
18107
+ structureId,
18108
+ matchUpsMap,
18109
+ });
18110
+ if (result.error)
18111
+ return result;
18112
+ result = removeDrawPositionAssignment({
18113
+ drawPosition: originalParticipantIdDrawPosition,
18114
+ inContextDrawMatchUps,
18115
+ tournamentRecord,
18116
+ drawDefinition,
18117
+ structureId,
18118
+ matchUpsMap,
18119
+ });
18120
+ if (result.error)
18121
+ return result;
18122
+ assignDrawPositionBye({
18123
+ drawPosition: originalParticipantIdDrawPosition,
18124
+ tournamentRecord,
18125
+ drawDefinition,
18126
+ structureId,
18127
+ matchUpsMap,
18128
+ event,
18129
+ });
18130
+ result = assignDrawPosition$1({
18131
+ drawPosition: originalByeDrawPosition,
18132
+ inContextDrawMatchUps,
18133
+ tournamentRecord,
18134
+ drawDefinition,
18135
+ structureId,
18136
+ participantId,
18137
+ matchUpsMap,
18138
+ event,
18139
+ });
18140
+ if (result.error)
18141
+ return result;
18142
+ return { ...SUCCESS };
18143
+ }
18144
+ function eliminationPosiitonSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, assignments, matchUpsMap, structure, event, }) {
18145
+ const newAssignments = Object.assign({}, ...assignments.map((assignment, index) => {
18146
+ const { drawPosition } = assignment;
18147
+ const newAssignment = { ...assignments[1 - index], drawPosition };
18148
+ return { [drawPosition]: newAssignment };
18149
+ }));
18150
+ structure.positionAssignments = structure.positionAssignments.map((assignment) => newAssignments[assignment.drawPosition] || assignment);
18151
+ resetLineUps({
18152
+ inContextDrawMatchUps,
18153
+ tournamentRecord,
18154
+ drawDefinition,
18155
+ matchUpsMap,
18156
+ assignments,
18157
+ structure,
18158
+ event,
18159
+ });
18160
+ return { ...SUCCESS };
18161
+ }
18162
+ function roundRobinSwap({ inContextDrawMatchUps, tournamentRecord, drawDefinition, drawPositions, matchUpsMap, structure, event, }) {
18163
+ const assignments = structure.structures?.reduce((assignments, structure) => {
18164
+ const structureAssignments = structure?.positionAssignments.filter((assignment) => drawPositions?.includes(assignment.drawPosition));
18165
+ if (structureAssignments)
18166
+ assignments.push(...structureAssignments);
18167
+ return assignments;
18168
+ }, []);
18169
+ if (assignments.filter(({ bye }) => bye).length === 2)
18170
+ return { ...SUCCESS };
18171
+ if (assignments.filter(({ qualifier }) => qualifier).length === 2)
18172
+ return { ...SUCCESS };
18173
+ resetLineUps({
18174
+ inContextDrawMatchUps,
18175
+ tournamentRecord,
18176
+ drawDefinition,
18177
+ matchUpsMap,
18178
+ assignments,
18179
+ structure,
18180
+ event,
18181
+ });
18182
+ const isQualifierSwap = assignments.some(({ qualifier }) => qualifier);
18183
+ const isByeSwap = assignments.some(({ bye }) => bye);
18184
+ if (isByeSwap && !isQualifierSwap) {
18185
+ swapParticipantIdWithBYE({
18186
+ inContextDrawMatchUps,
18187
+ tournamentRecord,
18188
+ drawDefinition,
18189
+ assignments,
18190
+ matchUpsMap,
18191
+ structure,
18192
+ event,
18193
+ });
18194
+ }
18195
+ else {
18196
+ const originalAssignments = makeDeepCopy(assignments, false, true);
18197
+ assignments.forEach((assignment, index) => {
18198
+ const newParticipantId = originalAssignments[1 - index].participantId;
18199
+ assignment.qualifier = originalAssignments[1 - index].qualifier;
18200
+ assignment.participantId = newParticipantId;
18201
+ });
18202
+ }
18203
+ return { ...SUCCESS };
18204
+ }
18205
+
18160
18206
  function removeSeededParticipant({ tournamentRecord, drawDefinition, participantId, structureId, }) {
18161
18207
  const stack = 'removeSeededParticipant';
18162
18208
  if (!tournamentRecord)
@@ -18477,6 +18523,50 @@ function addQualifying(params) {
18477
18523
  });
18478
18524
  }
18479
18525
 
18526
+ function adHocPositionSwap(params) {
18527
+ const paramsCheck = checkRequiredParameters(params, [
18528
+ { [DRAW_DEFINITION]: true, [STRUCTURE_ID]: true, [MATCHUP_ID]: true },
18529
+ { [ROUND_NUMBER]: true, [VALIDATE]: (value) => Number.isInteger(value) && value > 0 },
18530
+ {
18531
+ [VALIDATE]: (value) => Array.isArray(value) && value.length === 2 && value.every(isString),
18532
+ [INVALID]: INVALID_PARTICIPANT_IDS,
18533
+ participantIds: true,
18534
+ },
18535
+ ]);
18536
+ if (paramsCheck.error)
18537
+ return paramsCheck;
18538
+ const { drawDefinition, structureId, tournamentRecord, event } = params;
18539
+ const { structure } = findStructure({ drawDefinition, structureId });
18540
+ if (!structure)
18541
+ return { error: STRUCTURE_NOT_FOUND };
18542
+ if (!isAdHoc({ structure }))
18543
+ return { error: INVALID_STRUCTURE };
18544
+ const hasParticipant = (matchUp) => matchUp.sides?.map((side) => side.participantId).some((id) => params.participantIds.includes(id));
18545
+ const targetRoundNumber = (matchUp) => matchUp.roundNumber === params.roundNumber;
18546
+ const noScoreValue = (matchUp) => !checkScoreHasValue(matchUp);
18547
+ const targetMatchUps = (structure?.matchUps ?? [])
18548
+ .filter(targetRoundNumber)
18549
+ .filter(noScoreValue)
18550
+ .filter(hasParticipant);
18551
+ if (targetMatchUps.length !== 2)
18552
+ return { error: INVALID_PARTICIPANT_IDS };
18553
+ for (const matchUp of targetMatchUps) {
18554
+ const side = matchUp?.sides?.find((side) => params.participantIds.includes(side?.participantId));
18555
+ if (side) {
18556
+ const swappedParticipantId = params.participantIds.find((id) => id !== side?.participantId);
18557
+ side.participantId = swappedParticipantId;
18558
+ modifyMatchUpNotice({
18559
+ tournamentId: tournamentRecord?.tournamentId,
18560
+ eventId: event?.eventId,
18561
+ drawDefinition,
18562
+ matchUp,
18563
+ });
18564
+ }
18565
+ }
18566
+ modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
18567
+ return { ...SUCCESS };
18568
+ }
18569
+
18480
18570
  function buildFeedRound({ includeMatchUpType, drawPosition, roundNumber, matchUpType, idPrefix, matchUps, isMock, uuids, nodes, fed, }) {
18481
18571
  const feedRoundMatchUpsCount = nodes.length;
18482
18572
  const initialGroupDrawPosition = drawPosition ? drawPosition - feedRoundMatchUpsCount : undefined;
@@ -20068,8 +20158,8 @@ function calculatePercentages({ participantResults, matchUpFormat, tallyPolicy,
20068
20158
  let gamesPct = Math.round((gamesWon / gamesTotal) * 1000) / 1000;
20069
20159
  if (gamesPct === Infinity || isNaN(gamesPct))
20070
20160
  gamesPct = 0;
20071
- let pointsPct = Math.round((participantResults[participantId].pointsWon / participantResults[participantId].pointsLost) * 1000) /
20072
- 1000;
20161
+ const pointsTotal = participantResults[participantId].pointsWon + participantResults[participantId].pointsLost;
20162
+ let pointsPct = Math.round((participantResults[participantId].pointsWon / pointsTotal) * 1000) / 1000;
20073
20163
  if (pointsPct === Infinity || isNaN(pointsPct))
20074
20164
  pointsPct = 0;
20075
20165
  participantResults[participantId].setsWon = setsWon;
@@ -23631,6 +23721,7 @@ function setSubOrder({ tournamentRecord, drawDefinition, drawPosition, structure
23631
23721
 
23632
23722
  var mutate$c = {
23633
23723
  __proto__: null,
23724
+ adHocPositionSwap: adHocPositionSwap,
23634
23725
  addAdHocMatchUps: addAdHocMatchUps,
23635
23726
  addDrawDefinitionTimeItem: addDrawDefinitionTimeItem,
23636
23727
  addPlayoffStructures: addPlayoffStructures,
@@ -23962,48 +24053,6 @@ function getSourceStructureIdsAndRelevantLinks({ targetRoundNumber, finishingPos
23962
24053
  return { sourceStructureIds, relevantLinks };
23963
24054
  }
23964
24055
 
23965
- const QUALIFYING_PARTICIPANT_METHOD = 'qualifierDrawPositionAssignment';
23966
- const WITHDRAW_PARTICIPANT_METHOD = 'withdrawParticipantAtDrawPosition';
23967
- const ALTERNATE_PARTICIPANT_METHOD = 'alternateDrawPositionAssignment';
23968
- const LUCKY_PARTICIPANT_METHOD = 'luckyLoserDrawPositionAssignment';
23969
- const REMOVE_ASSIGNMENT_METHOD = 'removeDrawPositionAssignment';
23970
- const SWAP_PARTICIPANT_METHOD = 'swapDrawPositionAssignments';
23971
- const MODIFY_PAIR_ASSIGNMENT_METHOD = 'modifyPairAssignment';
23972
- const ADD_NICKNAME_METHOD = 'modifyParticipantOtherName';
23973
- const ASSIGN_PARTICIPANT_METHOD = 'assignDrawPosition';
23974
- const REMOVE_SEED_METHOD = 'removeSeededParticipant';
23975
- const ASSIGN_BYE_METHOD = 'assignDrawPositionBye';
23976
- const SEED_VALUE_METHOD = 'modifySeedAssignment';
23977
- const ADD_PENALTY_METHOD = 'addPenalty';
23978
- const MODIFY_PAIR_ASSIGNMENT = 'MODIFY_PAIR';
23979
- const QUALIFYING_PARTICIPANT = 'QUALIFIER';
23980
- const ALTERNATE_PARTICIPANT = 'ALTERNATE';
23981
- const WITHDRAW_PARTICIPANT = 'WITHDRAW';
23982
- const ASSIGN_PARTICIPANT = 'ASSIGN';
23983
- const REMOVE_ASSIGNMENT = 'REMOVE';
23984
- const LUCKY_PARTICIPANT = 'LUCKY';
23985
- const REMOVE_SEED = 'REMOVE_SEED';
23986
- const SWAP_PARTICIPANTS = 'SWAP';
23987
- const ADD_NICKNAME = 'NICKNAME';
23988
- const SEED_VALUE = 'SEED_VALUE';
23989
- const ADD_PENALTY = 'PENALTY';
23990
- const ASSIGN_BYE = 'BYE';
23991
- const positionActionConstants = {
23992
- MODIFY_PAIR_ASSIGNMENT,
23993
- QUALIFYING_PARTICIPANT,
23994
- ALTERNATE_PARTICIPANT,
23995
- WITHDRAW_PARTICIPANT,
23996
- ASSIGN_PARTICIPANT,
23997
- LUCKY_PARTICIPANT,
23998
- REMOVE_ASSIGNMENT,
23999
- SWAP_PARTICIPANTS,
24000
- ADD_NICKNAME,
24001
- REMOVE_SEED,
24002
- ADD_PENALTY,
24003
- ASSIGN_BYE,
24004
- SEED_VALUE,
24005
- };
24006
-
24007
24056
  function getValidModifyAssignedPairAction({ tournamentParticipants, returnParticipants, drawPosition, participant, drawId, event, }) {
24008
24057
  const availableIndividualParticipantIds = event?.entries
24009
24058
  ?.filter(({ entryStatus }) => [UNGROUPED, UNPAIRED].includes(entryStatus))
@@ -24423,7 +24472,10 @@ function getEventAlternateParticipantIds({ eventEntries, structure }) {
24423
24472
 
24424
24473
  function adHocMatchUpActions({ restrictAdHocRoundParticipants, tournamentParticipants, matchUpParticipantIds, otherFlightEntries, drawDefinition, structureId, sideNumber, matchUpId, structure, matchUp, drawId, event, }) {
24425
24474
  const validActions = [];
24426
- const roundMatchUps = (structure?.matchUps ?? []).filter(({ roundNumber }) => roundNumber === matchUp.roundNumber);
24475
+ const matchUps = structure?.matchUps ?? [];
24476
+ const side = matchUp.sides?.find((side) => side.sideNumber === sideNumber);
24477
+ const sideParticipantId = side?.participantId;
24478
+ const roundMatchUps = matchUps.filter(({ roundNumber }) => roundNumber === matchUp.roundNumber);
24427
24479
  const enteredParticipantIds = drawDefinition?.entries
24428
24480
  ?.filter(({ entryStatus }) => entryStatus && DIRECT_ENTRY_STATUSES.includes(entryStatus))
24429
24481
  .map(getParticipantId) ?? [];
@@ -24484,13 +24536,46 @@ function adHocMatchUpActions({ restrictAdHocRoundParticipants, tournamentPartici
24484
24536
  type: ALTERNATE,
24485
24537
  });
24486
24538
  }
24487
- if (!checkScoreHasValue(matchUp) && sideNumber) {
24488
- const side = matchUp.sides?.find((side) => side.sideNumber === sideNumber);
24489
- if (side?.participantId) {
24539
+ if (!checkScoreHasValue(matchUp) && sideNumber && sideParticipantId) {
24540
+ validActions.push({
24541
+ payload: { drawId, matchUpId, structureId, sideNumber },
24542
+ method: REMOVE_SIDE_METHOD,
24543
+ type: REMOVE_PARTICIPANT,
24544
+ });
24545
+ const getMatchUpPairing = (matchUp) => matchUp.sides.map(getParticipantId);
24546
+ const notThisMatchUp = ({ matchUpId }) => matchUpId !== matchUp.matchUpId;
24547
+ const noScoreValue = (matchUp) => !checkScoreHasValue(matchUp);
24548
+ const opponentParticipantId = matchUp.sides?.find((side) => side.sideNumber !== sideNumber)?.participantId;
24549
+ const otherRoundMatchUps = matchUps.filter(({ roundNumber }) => roundNumber !== matchUp.roundNumber);
24550
+ const otherRoundParticipantPairings = otherRoundMatchUps.filter(notThisMatchUp).map(getMatchUpPairing);
24551
+ const otherOpponents = [
24552
+ opponentParticipantId,
24553
+ ...otherRoundParticipantPairings.filter((pairing) => pairing.includes(sideParticipantId)).flat(),
24554
+ ].filter(Boolean);
24555
+ const notPreviousOpponent = (id) => !otherOpponents.flat().includes(id);
24556
+ const availableSwaps = roundMatchUps
24557
+ .filter(noScoreValue)
24558
+ .filter(notThisMatchUp)
24559
+ .map(getMatchUpPairing)
24560
+ .flat()
24561
+ .filter(notPreviousOpponent);
24562
+ if (availableSwaps.length) {
24563
+ const swappableParticipants = tournamentParticipants
24564
+ ?.filter((participant) => availableSwaps.includes(participant.participantId))
24565
+ .map((participant) => makeDeepCopy(participant, undefined, true));
24490
24566
  validActions.push({
24491
- payload: { drawId, matchUpId, structureId, sideNumber },
24492
- method: REMOVE_SIDE_METHOD,
24493
- type: REMOVE_PARTICIPANT,
24567
+ payload: {
24568
+ participantIds: [sideParticipantId],
24569
+ roundNumber: matchUp.roundNumber,
24570
+ structureId,
24571
+ sideNumber,
24572
+ matchUpId,
24573
+ drawId,
24574
+ },
24575
+ swappableParticipantIds: availableSwaps,
24576
+ method: SWAP_ADHOC_PARTICIPANT_METHOD,
24577
+ type: SWAP_PARTICIPANTS,
24578
+ swappableParticipants,
24494
24579
  });
24495
24580
  }
24496
24581
  }
@@ -25596,6 +25681,7 @@ var query$b = {
25596
25681
  getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
25597
25682
  getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
25598
25683
  getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
25684
+ getDrawStructures: getDrawStructures,
25599
25685
  getDrawTypeCoercion: getDrawTypeCoercion,
25600
25686
  getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
25601
25687
  getMatchUpsMap: getMatchUpsMap,
@@ -27396,7 +27482,7 @@ function reverseScore(params) {
27396
27482
  };
27397
27483
  }
27398
27484
 
27399
- var generate$2 = {
27485
+ var generate$3 = {
27400
27486
  __proto__: null,
27401
27487
  generateScoreString: generateScoreString,
27402
27488
  generateTieMatchUpScore: generateTieMatchUpScore,
@@ -30861,7 +30947,7 @@ var scoreGovernor = {
30861
30947
  checkScoreHasValue: checkScoreHasValue,
30862
30948
  checkSetIsComplete: checkSetIsComplete,
30863
30949
  clearHistory: clearHistory,
30864
- generate: generate$2,
30950
+ generate: generate$3,
30865
30951
  generateScoreString: generateScoreString,
30866
30952
  generateTieMatchUpScore: generateTieMatchUpScore,
30867
30953
  getSetComplement: getSetComplement,
@@ -37176,6 +37262,7 @@ var index$f = {
37176
37262
  getDrawData: getDrawData,
37177
37263
  getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
37178
37264
  getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
37265
+ getDrawStructures: getDrawStructures,
37179
37266
  getDrawTypeCoercion: getDrawTypeCoercion,
37180
37267
  getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
37181
37268
  getEntriesAndSeedsCount: getEntriesAndSeedsCount,
@@ -37513,6 +37600,7 @@ function autoSeeding({ tournamentRecord, drawDefinition, policyDefinitions, scal
37513
37600
 
37514
37601
  var index$e = {
37515
37602
  __proto__: null,
37603
+ adHocPositionSwap: adHocPositionSwap,
37516
37604
  addAdHocMatchUps: addAdHocMatchUps,
37517
37605
  addDrawDefinitionTimeItem: addDrawDefinitionTimeItem,
37518
37606
  addFinishingRounds: addFinishingRounds,
@@ -37550,6 +37638,7 @@ var index$e = {
37550
37638
  getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
37551
37639
  getDrawDefinitionTimeItem: getDrawDefinitionTimeItem,
37552
37640
  getDrawParticipantRepresentativeIds: getDrawParticipantRepresentativeIds,
37641
+ getDrawStructures: getDrawStructures,
37553
37642
  getDrawTypeCoercion: getDrawTypeCoercion,
37554
37643
  getEligibleVoluntaryConsolationParticipants: getEligibleVoluntaryConsolationParticipants,
37555
37644
  getMatchUpsMap: getMatchUpsMap,
@@ -46750,7 +46839,7 @@ function scheduleProfileRounds(params) {
46750
46839
  }
46751
46840
  }
46752
46841
 
46753
- function newTournamentRecord(params) {
46842
+ function createTournamentRecord(params) {
46754
46843
  const attributes = params || {};
46755
46844
  if (!attributes.tournamentId)
46756
46845
  attributes.tournamentId = UUID();
@@ -48589,7 +48678,7 @@ function smartComplete(params) {
48589
48678
  });
48590
48679
  }
48591
48680
 
48592
- function generateFlightDrawDefinitions({ matchUpStatusProfile, completeAllMatchUps, randomWinningSide, tournamentRecord, drawProfiles, event, }) {
48681
+ function generateFlightDrawDefinitions({ matchUpStatusProfile, completeAllMatchUps, randomWinningSide, tournamentRecord, drawProfiles, isMock, event, }) {
48593
48682
  const flightProfile = getFlightProfile({ event }).flightProfile;
48594
48683
  const { eventName, eventType, category } = event;
48595
48684
  const { startDate } = tournamentRecord;
@@ -48630,10 +48719,10 @@ function generateFlightDrawDefinitions({ matchUpStatusProfile, completeAllMatchU
48630
48719
  matchUpType: eventType,
48631
48720
  seedingScaleName,
48632
48721
  tournamentRecord,
48633
- isMock: true,
48634
48722
  drawEntries,
48635
48723
  drawName,
48636
48724
  drawId,
48725
+ isMock,
48637
48726
  event,
48638
48727
  stage,
48639
48728
  });
@@ -48663,8 +48752,8 @@ function generateFlightDrawDefinitions({ matchUpStatusProfile, completeAllMatchU
48663
48752
  ...drawProfile.withPlayoffs,
48664
48753
  tournamentRecord,
48665
48754
  drawDefinition,
48666
- isMock: true,
48667
48755
  structureId,
48756
+ isMock,
48668
48757
  event,
48669
48758
  });
48670
48759
  if (result?.error)
@@ -48928,6 +49017,7 @@ function generateEventWithFlights(params) {
48928
49017
  randomWinningSide,
48929
49018
  tournamentRecord,
48930
49019
  drawProfiles,
49020
+ isMock,
48931
49021
  event,
48932
49022
  });
48933
49023
  if (drawDefinitionResult.error)
@@ -49885,6 +49975,7 @@ const mockTournamentNames = [
49885
49975
  function generateTournamentRecord(params) {
49886
49976
  let { startDate, endDate } = params ?? {};
49887
49977
  const { tournamentName = randomPop(mockTournamentNames), ratingsParameters: ratingsParameters$1 = ratingsParameters, tournamentExtensions, policyDefinitions, schedulingProfile, venueProfiles, uuids, } = params ?? {};
49978
+ const isMock = params?.isMock === false ? undefined : true;
49888
49979
  if ((startDate && !isValidDateString(startDate)) || (endDate && !isValidDateString(endDate)))
49889
49980
  return { error: INVALID_DATE };
49890
49981
  if ((params.leagueProfiles && !Array.isArray(params.leagueProfiles)) ||
@@ -49900,18 +49991,18 @@ function generateTournamentRecord(params) {
49900
49991
  const tournamentDate = new Date(startDate);
49901
49992
  endDate = formatDate(tournamentDate.setDate(tournamentDate.getDate() + 7));
49902
49993
  }
49903
- const tournamentRecord = newTournamentRecord({
49994
+ const tournamentRecord = createTournamentRecord({
49904
49995
  ...(params.tournamentAttributes ?? {}),
49905
49996
  tournamentName,
49906
- isMock: true,
49907
49997
  startDate,
49908
49998
  endDate,
49999
+ isMock,
49909
50000
  });
49910
50001
  const venueIds = venueProfiles?.length ? generateVenues({ tournamentRecord, venueProfiles, uuids }) : [];
49911
50002
  if (tournamentExtensions?.length && Array.isArray(tournamentExtensions)) {
49912
50003
  const extensions = tournamentExtensions.filter((extension) => isValidExtension({ extension }));
49913
50004
  if (extensions?.length)
49914
- Object.assign(tournamentRecord, { extensions, isMock: true });
50005
+ Object.assign(tournamentRecord, { extensions, isMock });
49915
50006
  }
49916
50007
  if (typeof policyDefinitions === 'object') {
49917
50008
  for (const policyType of Object.keys(policyDefinitions)) {
@@ -50051,7 +50142,7 @@ function scheduleRounds(params) {
50051
50142
  return { scheduledRounds };
50052
50143
  }
50053
50144
 
50054
- var generate$1 = {
50145
+ var generate$2 = {
50055
50146
  __proto__: null,
50056
50147
  generateEventWithDraw: generateEventWithDraw,
50057
50148
  generateOutcome: generateOutcome,
@@ -50328,7 +50419,7 @@ function generatePairParticipantName({ individualParticipantIds, individualParti
50328
50419
  }
50329
50420
 
50330
50421
  function modifyTournamentRecord(params) {
50331
- const { ratingsParameters: ratingsParameters$1 = ratingsParameters, participantsProfile = {}, matchUpStatusProfile, completeAllMatchUps, autoEntryPositions, hydrateCollections, randomWinningSide, schedulingProfile, tournamentRecord, eventProfiles, periodLength, venueProfiles, autoSchedule, drawProfiles, uuids, } = params;
50422
+ const { ratingsParameters: ratingsParameters$1 = ratingsParameters, participantsProfile = {}, matchUpStatusProfile, completeAllMatchUps, autoEntryPositions, hydrateCollections, randomWinningSide, schedulingProfile, tournamentRecord, autoSchedule, eventProfiles, periodLength, venueProfiles, drawProfiles, isMock, uuids, } = params;
50332
50423
  if (!tournamentRecord)
50333
50424
  return { error: MISSING_TOURNAMENT_RECORD };
50334
50425
  const allUniqueParticipantIds = [];
@@ -50436,6 +50527,7 @@ function modifyTournamentRecord(params) {
50436
50527
  randomWinningSide,
50437
50528
  tournamentRecord,
50438
50529
  drawProfiles,
50530
+ isMock,
50439
50531
  event,
50440
50532
  });
50441
50533
  if (result.error)
@@ -50526,7 +50618,7 @@ var mutate$6 = {
50526
50618
  var mocksGovernor = {
50527
50619
  __proto__: null,
50528
50620
  anonymizeTournamentRecord: anonymizeTournamentRecord,
50529
- generate: generate$1,
50621
+ generate: generate$2,
50530
50622
  generateEventWithDraw: generateEventWithDraw,
50531
50623
  generateOutcome: generateOutcome,
50532
50624
  generateOutcomeFromScoreString: generateOutcomeFromScoreString,
@@ -55421,6 +55513,11 @@ var index$4 = {
55421
55513
  validateCollectionDefinition: validateCollectionDefinition
55422
55514
  };
55423
55515
 
55516
+ var generate$1 = {
55517
+ __proto__: null,
55518
+ createTournamentRecord: createTournamentRecord
55519
+ };
55520
+
55424
55521
  const ABANDONED = 'ABANDONED';
55425
55522
  const ACTIVE = 'ACTIVE';
55426
55523
  const CANCELLED = 'CANCELLED';
@@ -55812,6 +55909,8 @@ var index$3 = {
55812
55909
  addTournamentTimeItem: addTournamentTimeItem,
55813
55910
  analyzeDraws: analyzeDraws,
55814
55911
  analyzeTournament: analyzeTournament,
55912
+ createTournamentRecord: createTournamentRecord,
55913
+ generate: generate$1,
55815
55914
  getAllowedDrawTypes: getAllowedDrawTypes,
55816
55915
  getAllowedMatchUpFormats: getAllowedMatchUpFormats,
55817
55916
  getAppliedPolicies: getAppliedPolicies,
@@ -57306,7 +57405,7 @@ function engineStart(engine, engineInvoke) {
57306
57405
  };
57307
57406
  engine.getDevContext = (contextCriteria) => getDevContext(contextCriteria);
57308
57407
  engine.newTournamentRecord = (params = {}) => {
57309
- const result = newTournamentRecord(params);
57408
+ const result = createTournamentRecord(params);
57310
57409
  const tournamentId = result.tournamentId;
57311
57410
  if (result.error)
57312
57411
  return result;