tods-competition-factory 1.7.0 → 1.7.2

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.
@@ -1588,11 +1588,15 @@ function isValid(matchUpFormat) {
1588
1588
  if (typeof matchUpFormat !== "string")
1589
1589
  return false;
1590
1590
  const parsedFormat = parse(matchUpFormat);
1591
- const setParts = matchUpFormat.match(/-S:(\d+)+\/TB(\d+)@?(\d*)*/);
1591
+ const setParts = matchUpFormat.match(
1592
+ /-S:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/
1593
+ );
1592
1594
  const setsTo = setParts?.[1];
1593
1595
  const tiebreakTo = setParts?.[2];
1594
1596
  const tiebreakAt = setParts?.[3];
1595
- const finalSetParts = matchUpFormat.match(/-F:(\d+)+\/TB(\d+)@?(\d*)*/);
1597
+ const finalSetParts = matchUpFormat.match(
1598
+ /-F:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/
1599
+ );
1596
1600
  const finalSetTo = finalSetParts?.[1];
1597
1601
  const finalSetTiebreakTo = finalSetParts?.[2];
1598
1602
  const finalTiebreakAt = finalSetParts?.[3];
@@ -1758,15 +1762,17 @@ function validateTieFormat(params) {
1758
1762
  function validateCollectionDefinition({
1759
1763
  collectionDefinition,
1760
1764
  checkCollectionIds,
1765
+ checkGender = true,
1761
1766
  referenceGender,
1762
- checkGender
1767
+ event
1763
1768
  }) {
1769
+ referenceGender = referenceGender ?? event?.gender;
1764
1770
  const errors = [];
1765
1771
  if (typeof collectionDefinition !== "object") {
1766
1772
  errors.push(
1767
1773
  `collectionDefinition must be an object: ${collectionDefinition}`
1768
1774
  );
1769
- return { errors };
1775
+ return { errors, error: INVALID_OBJECT };
1770
1776
  }
1771
1777
  const {
1772
1778
  collectionValueProfiles,
@@ -1825,7 +1831,7 @@ function validateCollectionDefinition({
1825
1831
  errors.push(`Invalid gender: ${gender}`);
1826
1832
  }
1827
1833
  if (errors.length)
1828
- return { errors };
1834
+ return { errors, error: INVALID_OBJECT };
1829
1835
  return { valid: true };
1830
1836
  }
1831
1837
  function validateCollectionValueProfile({
@@ -12223,7 +12229,7 @@ function assignMatchUpDrawPosition({
12223
12229
  inContext: true,
12224
12230
  drawDefinition,
12225
12231
  matchUpsMap
12226
- }).matchUps || [];
12232
+ }).matchUps ?? [];
12227
12233
  }
12228
12234
  const inContextMatchUp = inContextDrawMatchUps.find(
12229
12235
  (m) => m.matchUpId === matchUpId
@@ -12237,7 +12243,7 @@ function assignMatchUpDrawPosition({
12237
12243
  const matchUp = matchUpsMap?.drawMatchUps?.find(
12238
12244
  (matchUp2) => matchUp2.matchUpId === matchUpId
12239
12245
  );
12240
- const drawPositions = matchUp?.drawPositions || [];
12246
+ const drawPositions = matchUp?.drawPositions ?? [];
12241
12247
  const { positionAdded, positionAssigned, updatedDrawPositions } = getUpdatedDrawPositions({ drawPosition, drawPositions });
12242
12248
  const { positionAssignments } = getPositionAssignments({
12243
12249
  drawDefinition,
@@ -12254,7 +12260,7 @@ function assignMatchUpDrawPosition({
12254
12260
  inContext: true,
12255
12261
  drawDefinition,
12256
12262
  matchUpsMap
12257
- }).matchUps || [];
12263
+ }).matchUps ?? [];
12258
12264
  const exitWinningSide = isDoubleExitExit && getExitWinningSide({
12259
12265
  inContextDrawMatchUps,
12260
12266
  drawPosition,
@@ -12342,7 +12348,7 @@ function assignMatchUpDrawPosition({
12342
12348
  const inContextTargetMatchUp = inContextDrawMatchUps?.find(
12343
12349
  ({ matchUpId: matchUpId2 }) => matchUpId2 === matchUp.matchUpId
12344
12350
  );
12345
- const sides = inContextTargetMatchUp?.sides || [];
12351
+ const sides = inContextTargetMatchUp?.sides ?? [];
12346
12352
  const drawPositionSideIndex = sides.reduce(
12347
12353
  (index, side, i) => side.drawPosition === drawPosition ? i : index,
12348
12354
  void 0