tods-competition-factory 1.7.16 → 1.7.18

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 CHANGED
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
333
333
  };
334
334
 
335
335
  function factoryVersion() {
336
- return "1.7.16";
336
+ return "1.7.18";
337
337
  }
338
338
 
339
339
  function getObjectTieFormat(obj) {
@@ -13480,7 +13480,7 @@ const ratingsParameters = {
13480
13480
  }
13481
13481
  };
13482
13482
 
13483
- var collectionDefinitions$i = [
13483
+ var collectionDefinitions$j = [
13484
13484
  {
13485
13485
  collectionName: "Doubles",
13486
13486
  matchUpCount: 3,
@@ -13496,17 +13496,17 @@ var collectionDefinitions$i = [
13496
13496
  matchUpValue: 1
13497
13497
  }
13498
13498
  ];
13499
- var tieFormatName$i = "COLLEGE_D3";
13500
- var winCriteria$i = {
13499
+ var tieFormatName$j = "COLLEGE_D3";
13500
+ var winCriteria$j = {
13501
13501
  valueGoal: 5
13502
13502
  };
13503
13503
  var COLLEGE_D3$1 = {
13504
- collectionDefinitions: collectionDefinitions$i,
13505
- tieFormatName: tieFormatName$i,
13506
- winCriteria: winCriteria$i
13504
+ collectionDefinitions: collectionDefinitions$j,
13505
+ tieFormatName: tieFormatName$j,
13506
+ winCriteria: winCriteria$j
13507
13507
  };
13508
13508
 
13509
- var collectionDefinitions$h = [
13509
+ var collectionDefinitions$i = [
13510
13510
  {
13511
13511
  collectionName: "Doubles",
13512
13512
  collectionValue: 1,
@@ -13522,17 +13522,17 @@ var collectionDefinitions$h = [
13522
13522
  matchUpValue: 1
13523
13523
  }
13524
13524
  ];
13525
- var tieFormatName$h = "COLLEGE_DEFAULT";
13526
- var winCriteria$h = {
13525
+ var tieFormatName$i = "COLLEGE_DEFAULT";
13526
+ var winCriteria$i = {
13527
13527
  valueGoal: 5
13528
13528
  };
13529
13529
  var COLLEGE_DEFAULT$1 = {
13530
- collectionDefinitions: collectionDefinitions$h,
13531
- tieFormatName: tieFormatName$h,
13532
- winCriteria: winCriteria$h
13530
+ collectionDefinitions: collectionDefinitions$i,
13531
+ tieFormatName: tieFormatName$i,
13532
+ winCriteria: winCriteria$i
13533
13533
  };
13534
13534
 
13535
- var collectionDefinitions$g = [
13535
+ var collectionDefinitions$h = [
13536
13536
  {
13537
13537
  collectionName: "Doubles",
13538
13538
  matchUpCount: 3,
@@ -13548,17 +13548,17 @@ var collectionDefinitions$g = [
13548
13548
  matchUpValue: 1
13549
13549
  }
13550
13550
  ];
13551
- var tieFormatName$g = "COLLEGE_JUCO";
13552
- var winCriteria$g = {
13551
+ var tieFormatName$h = "COLLEGE_JUCO";
13552
+ var winCriteria$h = {
13553
13553
  valueGoal: 5
13554
13554
  };
13555
13555
  var COLLEGE_JUCO$1 = {
13556
- collectionDefinitions: collectionDefinitions$g,
13557
- tieFormatName: tieFormatName$g,
13558
- winCriteria: winCriteria$g
13556
+ collectionDefinitions: collectionDefinitions$h,
13557
+ tieFormatName: tieFormatName$h,
13558
+ winCriteria: winCriteria$h
13559
13559
  };
13560
13560
 
13561
- var collectionDefinitions$f = [
13561
+ var collectionDefinitions$g = [
13562
13562
  {
13563
13563
  collectionName: "Doubles",
13564
13564
  matchUpCount: 1,
@@ -13574,17 +13574,17 @@ var collectionDefinitions$f = [
13574
13574
  matchUpValue: 1
13575
13575
  }
13576
13576
  ];
13577
- var tieFormatName$f = "DOMINANT_DUO";
13578
- var winCriteria$f = {
13577
+ var tieFormatName$g = "DOMINANT_DUO";
13578
+ var winCriteria$g = {
13579
13579
  valueGoal: 2
13580
13580
  };
13581
13581
  var DOMINANT_DUO_TIE_FORMAT = {
13582
- collectionDefinitions: collectionDefinitions$f,
13583
- tieFormatName: tieFormatName$f,
13584
- winCriteria: winCriteria$f
13582
+ collectionDefinitions: collectionDefinitions$g,
13583
+ tieFormatName: tieFormatName$g,
13584
+ winCriteria: winCriteria$g
13585
13585
  };
13586
13586
 
13587
- var collectionDefinitions$e = [
13587
+ var collectionDefinitions$f = [
13588
13588
  {
13589
13589
  collectionName: "Mixed Doubles",
13590
13590
  gender: "MIXED",
@@ -13610,17 +13610,17 @@ var collectionDefinitions$e = [
13610
13610
  matchUpValue: 1
13611
13611
  }
13612
13612
  ];
13613
- var tieFormatName$e = "DOMINANT_DUO_MIXED";
13614
- var winCriteria$e = {
13613
+ var tieFormatName$f = "DOMINANT_DUO_MIXED";
13614
+ var winCriteria$f = {
13615
13615
  valueGoal: 2
13616
13616
  };
13617
13617
  var DOMINANT_DUO_MIXED_TIE_FORMAT = {
13618
- collectionDefinitions: collectionDefinitions$e,
13619
- tieFormatName: tieFormatName$e,
13620
- winCriteria: winCriteria$e
13618
+ collectionDefinitions: collectionDefinitions$f,
13619
+ tieFormatName: tieFormatName$f,
13620
+ winCriteria: winCriteria$f
13621
13621
  };
13622
13622
 
13623
- var collectionDefinitions$d = [
13623
+ var collectionDefinitions$e = [
13624
13624
  {
13625
13625
  collectionGroupNumber: 1,
13626
13626
  matchUpType: "DOUBLES",
@@ -13678,18 +13678,18 @@ var collectionGroups$1 = [
13678
13678
  groupName: "Day 3"
13679
13679
  }
13680
13680
  ];
13681
- var tieFormatName$d = "LAVER_CUP";
13682
- var winCriteria$d = {
13681
+ var tieFormatName$e = "LAVER_CUP";
13682
+ var winCriteria$e = {
13683
13683
  valueGoal: 13
13684
13684
  };
13685
13685
  var LAVER_CUP_TIE_FORMAT = {
13686
- collectionDefinitions: collectionDefinitions$d,
13686
+ collectionDefinitions: collectionDefinitions$e,
13687
13687
  collectionGroups: collectionGroups$1,
13688
- tieFormatName: tieFormatName$d,
13689
- winCriteria: winCriteria$d
13688
+ tieFormatName: tieFormatName$e,
13689
+ winCriteria: winCriteria$e
13690
13690
  };
13691
13691
 
13692
- var collectionDefinitions$c = [
13692
+ var collectionDefinitions$d = [
13693
13693
  {
13694
13694
  collectionName: "Round 1",
13695
13695
  matchUpCount: 3,
@@ -13712,19 +13712,19 @@ var collectionDefinitions$c = [
13712
13712
  scoreValue: 1
13713
13713
  }
13714
13714
  ];
13715
- var tieFormatName$c = "Doubles Shuffle";
13715
+ var tieFormatName$d = "Doubles Shuffle";
13716
13716
  var unrestrictedSelections = true;
13717
- var winCriteria$c = {
13717
+ var winCriteria$d = {
13718
13718
  aggregateValue: true
13719
13719
  };
13720
13720
  var TEAM_AGGREGATION_TIE_FORMAT = {
13721
- collectionDefinitions: collectionDefinitions$c,
13722
- tieFormatName: tieFormatName$c,
13721
+ collectionDefinitions: collectionDefinitions$d,
13722
+ tieFormatName: tieFormatName$d,
13723
13723
  unrestrictedSelections: unrestrictedSelections,
13724
- winCriteria: winCriteria$c
13724
+ winCriteria: winCriteria$d
13725
13725
  };
13726
13726
 
13727
- var collectionDefinitions$b = [
13727
+ var collectionDefinitions$c = [
13728
13728
  {
13729
13729
  scoreValue: 1,
13730
13730
  matchUpType: "SINGLES",
@@ -13766,11 +13766,47 @@ var collectionDefinitions$b = [
13766
13766
  matchUpCount: 1
13767
13767
  }
13768
13768
  ];
13769
- var tieFormatName$b = "Time Tennis";
13769
+ var tieFormatName$c = "Time Tennis Dual";
13770
+ var winCriteria$c = {
13771
+ aggregateValue: true
13772
+ };
13773
+ var TIME_TENNIS_DUAL_TIE_FORMAT = {
13774
+ collectionDefinitions: collectionDefinitions$c,
13775
+ tieFormatName: tieFormatName$c,
13776
+ winCriteria: winCriteria$c
13777
+ };
13778
+
13779
+ var collectionDefinitions$b = [
13780
+ {
13781
+ scoreValue: 1,
13782
+ matchUpType: "SINGLES",
13783
+ collectionName: "Men's Singles",
13784
+ matchUpFormat: "SET1-S:T60",
13785
+ gender: "MALE",
13786
+ matchUpCount: 1
13787
+ },
13788
+ {
13789
+ scoreValue: 1,
13790
+ matchUpType: "SINGLES",
13791
+ collectionName: "Women's Singles",
13792
+ matchUpFormat: "SET1-S:T60",
13793
+ gender: "FEMALE",
13794
+ matchUpCount: 1
13795
+ },
13796
+ {
13797
+ matchUpValue: 1,
13798
+ matchUpType: "DOUBLES",
13799
+ collectionName: "Mixed Doubles",
13800
+ matchUpFormat: "SET1-S:T60",
13801
+ gender: "MIXED",
13802
+ matchUpCount: 1
13803
+ }
13804
+ ];
13805
+ var tieFormatName$b = "Time Tennis Pro Circuit";
13770
13806
  var winCriteria$b = {
13771
13807
  aggregateValue: true
13772
13808
  };
13773
- var TIME_TENNIS_TIE_FORMAT = {
13809
+ var TIME_TENNIS_PRO_TIE_FORMAT = {
13774
13810
  collectionDefinitions: collectionDefinitions$b,
13775
13811
  tieFormatName: tieFormatName$b,
13776
13812
  winCriteria: winCriteria$b
@@ -14550,7 +14586,8 @@ const tieFormats = {
14550
14586
  DOMINANT_DUO_MIXED: DOMINANT_DUO_MIXED_TIE_FORMAT,
14551
14587
  LAVER_CUP: LAVER_CUP_TIE_FORMAT,
14552
14588
  TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT,
14553
- TIME_TENNIS: TIME_TENNIS_TIE_FORMAT,
14589
+ TIME_TENNIS_DUAL: TIME_TENNIS_DUAL_TIE_FORMAT,
14590
+ TIME_TENNIS_PRO_CIRCUIT: TIME_TENNIS_PRO_TIE_FORMAT,
14554
14591
  USTA_BREWER_CUP: USTA_BREWER_CUP_TIE_FORMAT,
14555
14592
  USTA_OZAKI_CUP: USTA_OZAKI_CUP_TIE_FORMAT,
14556
14593
  USTA_COLLEGE: USTA_COLLEGE_TIE_FORMAT,
@@ -15470,6 +15507,9 @@ function initializeParticipantId({ participantMap, participantId }) {
15470
15507
  groupParticipantIds: [],
15471
15508
  pairParticipantIds: [],
15472
15509
  teamParticipantIds: [],
15510
+ seedings: {},
15511
+ rankings: {},
15512
+ ratings: {},
15473
15513
  groups: [],
15474
15514
  teams: []
15475
15515
  },
@@ -28859,11 +28899,27 @@ function getParticipantEntries(params) {
28859
28899
  seedAssignments[MAIN] = mainSeeding;
28860
28900
  if (seedAssignments && qualifyingSeeding)
28861
28901
  seedAssignments[QUALIFYING] = mainSeeding;
28902
+ const seedValue = mainSeeding || qualifyingSeeding;
28903
+ if (seedValue) {
28904
+ if (!participantMap[id].participant.seedings[eventType])
28905
+ participantMap[id].participant.seedings[eventType] = [];
28906
+ participantMap[id].participant.seedings[eventType].push({
28907
+ scaleValue: seedValue,
28908
+ scaleName: drawId
28909
+ });
28910
+ if (seedAssignments) {
28911
+ if (!participantMap[id].events[eventId].seedAssignments)
28912
+ participantMap[id].events[eventId].seedAssignments = {};
28913
+ Object.keys(seedAssignments).forEach(
28914
+ (stage) => participantMap[id].events[eventId].seedAssignments[stage] = seedAssignments[stage]
28915
+ );
28916
+ }
28917
+ }
28862
28918
  if ((withEvents || withRankingProfile) && participantMap[id] && eventId) {
28863
28919
  if (!participantMap[id].events[eventId])
28864
28920
  participantMap[id].events[eventId] = {};
28865
28921
  if (includeSeeding) {
28866
- participantMap[id].events[eventId].seedValue = mainSeeding || qualifyingSeeding;
28922
+ participantMap[id].events[eventId].seedValue = seedValue;
28867
28923
  } else if (participantMap[id].events[eventId].seedValue) {
28868
28924
  participantMap[id].events[eventId].seedValue = void 0;
28869
28925
  }
@@ -43702,17 +43758,19 @@ function generateAndPopulatePlayoffStructures(params) {
43702
43758
  loserMatchUp
43703
43759
  }
43704
43760
  } = targetData;
43705
- const targetStructureId = loserTargetLink.target.structureId;
43706
- const targetDrawPosition = loserMatchUp.drawPositions[loserMatchUpDrawPositionIndex];
43707
- const result = assignDrawPositionBye$1({
43708
- drawPosition: targetDrawPosition,
43709
- structureId: targetStructureId,
43710
- tournamentRecord,
43711
- drawDefinition,
43712
- event
43713
- });
43714
- if (result.error)
43715
- console.log(result.error);
43761
+ if (loserTargetLink && loserMatchUp) {
43762
+ const targetStructureId = loserTargetLink.target.structureId;
43763
+ const targetDrawPosition = loserMatchUp.drawPositions[loserMatchUpDrawPositionIndex];
43764
+ const result = assignDrawPositionBye$1({
43765
+ drawPosition: targetDrawPosition,
43766
+ structureId: targetStructureId,
43767
+ tournamentRecord,
43768
+ drawDefinition,
43769
+ event
43770
+ });
43771
+ if (result.error)
43772
+ console.log(result.error);
43773
+ }
43716
43774
  });
43717
43775
  const matchUpModifications = [];
43718
43776
  const goesToMap = addGoesTo({
@@ -55518,7 +55576,8 @@ const DOMINANT_DUO = "DOMINANT_DUO";
55518
55576
  const DOMINANT_DUO_MIXED = "DOMINANT_DUO_MIXED";
55519
55577
  const LAVER_CUP = "LAVER_CUP";
55520
55578
  const TEAM_DOUBLES_3_AGGREGATION = "TEAM_DOUBLES_3_AGGREGATION";
55521
- const TIME_TENNIS = "TIME_TENNIS";
55579
+ const TIME_TENNIS_DUAL = "TIME_TENNIS_DUAL";
55580
+ const TIME_TENNIS_PRO_CIRCUIT = "TIME_TENNIS_PRO_CIRCUIT";
55522
55581
  const USTA_BREWER_CUP = "USTA_BREWER_CUP";
55523
55582
  const USTA_OZAKI_CUP = "USTA_OZAKI_CUP";
55524
55583
  const USTA_COLLEGE = "USTA_COLLEGE";
@@ -55538,7 +55597,8 @@ const tieFormatConstants = {
55538
55597
  DOMINANT_DUO_MIXED,
55539
55598
  LAVER_CUP,
55540
55599
  TEAM_DOUBLES_3_AGGREGATION,
55541
- TIME_TENNIS,
55600
+ TIME_TENNIS_DUAL,
55601
+ TIME_TENNIS_PRO_CIRCUIT,
55542
55602
  USTA_BREWER_CUP,
55543
55603
  USTA_OZAKI_CUP,
55544
55604
  USTA_COLLEGE,
@@ -55609,7 +55669,8 @@ const namedFormats = {
55609
55669
  [DOMINANT_DUO]: DOMINANT_DUO_TIE_FORMAT,
55610
55670
  [DOMINANT_DUO_MIXED]: DOMINANT_DUO_MIXED_TIE_FORMAT,
55611
55671
  [TEAM_DOUBLES_3_AGGREGATION]: TEAM_AGGREGATION_TIE_FORMAT,
55612
- [TIME_TENNIS]: TIME_TENNIS_TIE_FORMAT,
55672
+ [TIME_TENNIS_DUAL]: TIME_TENNIS_DUAL_TIE_FORMAT,
55673
+ [TIME_TENNIS_PRO_CIRCUIT]: TIME_TENNIS_PRO_TIE_FORMAT,
55613
55674
  [USTA_BREWER_CUP]: USTA_BREWER_CUP_TIE_FORMAT,
55614
55675
  [USTA_OZAKI_CUP]: USTA_OZAKI_CUP_TIE_FORMAT,
55615
55676
  [USTA_COLLEGE]: USTA_COLLEGE_TIE_FORMAT,
@@ -55626,7 +55687,7 @@ const tieFormatDefaults = (params) => {
55626
55687
  const namedFormat = params?.namedFormat && Object.keys(namedFormats).includes(params.namedFormat) ? params.namedFormat : STANDARD;
55627
55688
  const uuids = Array.isArray(params?.uuids) ? params?.uuids : [];
55628
55689
  let tieFormat;
55629
- const { category, gender } = params?.event || {};
55690
+ const { category, gender } = params?.event ?? {};
55630
55691
  const template = makeDeepCopy(namedFormats[namedFormat], false, true);
55631
55692
  if (!template.hydrate) {
55632
55693
  template.collectionDefinitions.forEach(
@@ -55640,14 +55701,14 @@ const tieFormatDefaults = (params) => {
55640
55701
  },
55641
55702
  collectionDefinitions: [
55642
55703
  {
55643
- collectionId: uuids?.pop() || UUID(),
55704
+ collectionId: uuids?.pop() ?? UUID(),
55644
55705
  matchUpFormat: FORMAT_ATP_DOUBLES,
55645
55706
  matchUpType: TypeEnum.Doubles,
55646
55707
  collectionName: "Doubles",
55647
55708
  ...template.doubles
55648
55709
  },
55649
55710
  {
55650
- collectionId: uuids?.pop() || UUID(),
55711
+ collectionId: uuids?.pop() ?? UUID(),
55651
55712
  matchUpType: TypeEnum.Singles,
55652
55713
  matchUpFormat: FORMAT_STANDARD,
55653
55714
  collectionName: "Singles",