tods-competition-factory 1.8.46 → 1.9.1

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.
@@ -1214,13 +1214,18 @@ function isString(obj) {
1214
1214
  return typeof obj === "string";
1215
1215
  }
1216
1216
  function isObject(obj) {
1217
- return typeof obj === "object";
1217
+ return obj !== null && typeof obj === "object";
1218
1218
  }
1219
1219
  const extractAttributes = (accessor) => (element) => !accessor || typeof element !== "object" ? void 0 : Array.isArray(accessor) && accessor.map((a) => ({
1220
1220
  [a]: getAccessorValue({ element, accessor: a })?.value
1221
1221
  })) || typeof accessor === "object" && Object.keys(accessor).map((key) => ({
1222
1222
  [key]: getAccessorValue({ element, accessor: key })?.value
1223
1223
  })) || (typeof accessor === "string" && getAccessorValue({ element, accessor }))?.value;
1224
+ function getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays) {
1225
+ return Object.keys(obj).filter(
1226
+ (key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
1227
+ );
1228
+ }
1224
1229
  function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
1225
1230
  if (typeof obj !== "object" || obj === null)
1226
1231
  return obj;
@@ -1230,9 +1235,7 @@ function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
1230
1235
  const ignoreValues = ["", void 0, null];
1231
1236
  if (ignoreFalse)
1232
1237
  ignoreValues.push(false);
1233
- const definedKeys = Object.keys(obj).filter(
1234
- (key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
1235
- );
1238
+ const definedKeys = getDefinedKeys(obj, ignoreValues, ignoreEmptyArrays);
1236
1239
  return Object.assign(
1237
1240
  {},
1238
1241
  ...definedKeys.map((key) => {
@@ -2214,6 +2217,7 @@ const RESUME_TIME = "SCHEDULE.TIME.RESUME";
2214
2217
  const END_TIME = "SCHEDULE.TIME.END";
2215
2218
  const TIME_MODIFIERS = "SCHEDULE.TIME.MODIFIERS";
2216
2219
  const PUBLISH = "PUBLISH";
2220
+ const PUBLIC = "PUBLIC";
2217
2221
  const STATUS = "STATUS";
2218
2222
 
2219
2223
  function getTimeStamp(item) {
@@ -2436,8 +2440,10 @@ function getMatchUpScheduleDetails({
2436
2440
  scheduleVisibilityFilters,
2437
2441
  afterRecoveryTimes,
2438
2442
  tournamentRecord,
2443
+ usePublishState,
2439
2444
  scheduleTiming,
2440
2445
  matchUpFormat,
2446
+ publishStatus,
2441
2447
  matchUpType,
2442
2448
  matchUp,
2443
2449
  event
@@ -2554,15 +2560,36 @@ function getMatchUpScheduleDetails({
2554
2560
  });
2555
2561
  } else {
2556
2562
  schedule = definedAttributes({
2557
- time,
2563
+ milliseconds,
2558
2564
  startTime,
2559
2565
  endTime,
2560
- milliseconds
2566
+ time
2561
2567
  });
2562
2568
  }
2563
- const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
2564
2569
  const { scheduledDate } = scheduledMatchUpDate({ matchUp });
2565
2570
  const { scheduledTime } = scheduledMatchUpTime({ matchUp });
2571
+ if (usePublishState && publishStatus?.displaySettings?.draws) {
2572
+ const drawSettings = publishStatus.displaySettings.draws;
2573
+ const scheduleDetails = (drawSettings?.[matchUp.drawId] ?? drawSettings?.default)?.scheduleDetails;
2574
+ if (scheduleDetails) {
2575
+ const scheduleAttributes = (scheduleDetails.find(
2576
+ (details) => scheduledDate && details.dates?.includes(scheduledDate)
2577
+ ) ?? scheduleDetails.find((details) => !details.dates?.length))?.attributes;
2578
+ if (scheduleAttributes) {
2579
+ const template = Object.assign(
2580
+ {},
2581
+ ...Object.keys(schedule).map((key) => ({ [key]: true })),
2582
+ // overwrite with publishStatus attributes
2583
+ scheduleAttributes
2584
+ );
2585
+ schedule = attributeFilter({
2586
+ source: schedule,
2587
+ template
2588
+ });
2589
+ }
2590
+ }
2591
+ }
2592
+ const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
2566
2593
  const endDate = hasCompletedStatus && (extractDate(endTime) || extractDate(scheduledDate) || extractDate(scheduledTime)) || void 0;
2567
2594
  return { schedule, endDate };
2568
2595
  }
@@ -4505,6 +4532,7 @@ function getAllStructureMatchUps({
4505
4532
  policyDefinitions,
4506
4533
  tournamentRecord,
4507
4534
  seedAssignments,
4535
+ usePublishState,
4508
4536
  contextFilters,
4509
4537
  contextContent,
4510
4538
  matchUpFilters,
@@ -4512,6 +4540,7 @@ function getAllStructureMatchUps({
4512
4540
  scheduleTiming,
4513
4541
  contextProfile,
4514
4542
  drawDefinition,
4543
+ publishStatus,
4515
4544
  context = {},
4516
4545
  exitProfiles,
4517
4546
  matchUpsMap,
@@ -4620,6 +4649,8 @@ function getAllStructureMatchUps({
4620
4649
  roundNamingProfile,
4621
4650
  initialRoundOfPlay,
4622
4651
  appliedPolicies,
4652
+ usePublishState,
4653
+ publishStatus,
4623
4654
  isRoundRobin,
4624
4655
  roundProfile,
4625
4656
  matchUp,
@@ -4689,6 +4720,8 @@ function getAllStructureMatchUps({
4689
4720
  tieDrawPositions,
4690
4721
  appliedPolicies: appliedPolicies2,
4691
4722
  isCollectionBye,
4723
+ usePublishState: usePublishState2,
4724
+ publishStatus: publishStatus2,
4692
4725
  matchUpTieId,
4693
4726
  isRoundRobin: isRoundRobin2,
4694
4727
  roundProfile: roundProfile2,
@@ -4714,8 +4747,10 @@ function getAllStructureMatchUps({
4714
4747
  scheduleVisibilityFilters: scheduleVisibilityFilters2,
4715
4748
  afterRecoveryTimes,
4716
4749
  tournamentRecord,
4750
+ usePublishState: usePublishState2,
4717
4751
  scheduleTiming,
4718
4752
  matchUpFormat,
4753
+ publishStatus: publishStatus2,
4719
4754
  matchUpType,
4720
4755
  matchUp,
4721
4756
  event: event2
@@ -4838,7 +4873,7 @@ function getAllStructureMatchUps({
4838
4873
  Object.assign(matchUpWithContext, makeDeepCopy({ sides }, true, true));
4839
4874
  }
4840
4875
  if (tournamentParticipants && matchUpWithContext.sides) {
4841
- const participantAttributes = policyDefinitions?.[POLICY_TYPE_PARTICIPANT];
4876
+ const participantAttributes = appliedPolicies2?.[POLICY_TYPE_PARTICIPANT];
4842
4877
  const getMappedParticipant = (participantId) => {
4843
4878
  const participant = participantMap?.[participantId]?.participant;
4844
4879
  return participant && attributeFilter({
@@ -4954,6 +4989,8 @@ function getAllStructureMatchUps({
4954
4989
  additionalContext: additionalContext2,
4955
4990
  appliedPolicies: appliedPolicies2,
4956
4991
  isCollectionBye: isCollectionBye2,
4992
+ usePublishState: usePublishState2,
4993
+ publishStatus: publishStatus2,
4957
4994
  matchUpTieId: matchUpTieId2,
4958
4995
  isRoundRobin: isRoundRobin2,
4959
4996
  roundProfile: roundProfile2,
@@ -5866,6 +5903,64 @@ function getSeedPattern(seedingProfile) {
5866
5903
  return seedingProfile.positioning;
5867
5904
  }
5868
5905
 
5906
+ function getTimeItem({
5907
+ returnPreviousValues,
5908
+ itemSubTypes,
5909
+ itemType,
5910
+ element
5911
+ }) {
5912
+ if (!element)
5913
+ return { error: MISSING_VALUE, info: ELEMENT_REQUIRED };
5914
+ if (itemSubTypes && !Array.isArray(itemSubTypes))
5915
+ return { error: INVALID_VALUES, context: { itemSubTypes } };
5916
+ if (!Array.isArray(element.timeItems))
5917
+ return { error: MISSING_TIME_ITEMS };
5918
+ const filteredSorted = element.timeItems.filter((timeItem2) => timeItem2?.itemType === itemType).filter(
5919
+ (timeItem2) => !itemSubTypes?.length || itemSubTypes.some(
5920
+ (subType) => timeItem2?.itemSubTypes?.includes(subType)
5921
+ )
5922
+ ).sort((a, b) => {
5923
+ const aDate = new Date(a.createdAt || void 0).getTime();
5924
+ const bDate = new Date(b.createdAt || void 0).getTime();
5925
+ return aDate - bDate;
5926
+ });
5927
+ const timeItem = filteredSorted.pop();
5928
+ if (timeItem) {
5929
+ const result = { timeItem, ...SUCCESS };
5930
+ if (returnPreviousValues)
5931
+ Object.assign(result, { previousItems: filteredSorted });
5932
+ return result;
5933
+ } else {
5934
+ return { info: NOT_FOUND };
5935
+ }
5936
+ }
5937
+ function getEventTimeItem({
5938
+ returnPreviousValues,
5939
+ itemSubTypes,
5940
+ itemType,
5941
+ event
5942
+ }) {
5943
+ if (!event)
5944
+ return { error: MISSING_EVENT };
5945
+ if (!event.timeItems)
5946
+ return { info: NOT_FOUND };
5947
+ const { timeItem, previousItems, info } = getTimeItem({
5948
+ returnPreviousValues,
5949
+ element: event,
5950
+ itemSubTypes,
5951
+ itemType
5952
+ });
5953
+ return timeItem && { timeItem, previousItems } || { info };
5954
+ }
5955
+
5956
+ function getEventPublishStatus({ event, status = PUBLIC }) {
5957
+ const itemType = `${PUBLISH}.${STATUS}`;
5958
+ return getEventTimeItem({
5959
+ itemType,
5960
+ event
5961
+ })?.timeItem?.itemValue?.[status];
5962
+ }
5963
+
5869
5964
  function addParticipantGroupings({
5870
5965
  participantsProfile,
5871
5966
  participants = [],
@@ -7724,38 +7819,6 @@ function addIndividualParticipants({ participantMap, template }) {
7724
7819
  }
7725
7820
  }
7726
7821
 
7727
- function getTimeItem({
7728
- returnPreviousValues,
7729
- itemSubTypes,
7730
- itemType,
7731
- element
7732
- }) {
7733
- if (!element)
7734
- return { error: MISSING_VALUE, info: ELEMENT_REQUIRED };
7735
- if (itemSubTypes && !Array.isArray(itemSubTypes))
7736
- return { error: INVALID_VALUES, context: { itemSubTypes } };
7737
- if (!Array.isArray(element.timeItems))
7738
- return { error: MISSING_TIME_ITEMS };
7739
- const filteredSorted = element.timeItems.filter((timeItem2) => timeItem2?.itemType === itemType).filter(
7740
- (timeItem2) => !itemSubTypes?.length || itemSubTypes.some(
7741
- (subType) => timeItem2?.itemSubTypes?.includes(subType)
7742
- )
7743
- ).sort((a, b) => {
7744
- const aDate = new Date(a.createdAt || void 0).getTime();
7745
- const bDate = new Date(b.createdAt || void 0).getTime();
7746
- return aDate - bDate;
7747
- });
7748
- const timeItem = filteredSorted.pop();
7749
- if (timeItem) {
7750
- const result = { timeItem, ...SUCCESS };
7751
- if (returnPreviousValues)
7752
- Object.assign(result, { previousItems: filteredSorted });
7753
- return result;
7754
- } else {
7755
- return { info: NOT_FOUND };
7756
- }
7757
- }
7758
-
7759
7822
  const typeMap = {
7760
7823
  [GROUP]: "groupParticipantIds",
7761
7824
  [PAIR]: "pairParticipantIds",
@@ -8483,11 +8546,13 @@ function getStructureMatchUps({
8483
8546
  afterRecoveryTimes,
8484
8547
  policyDefinitions,
8485
8548
  tournamentRecord,
8549
+ usePublishState,
8486
8550
  matchUpFilters,
8487
8551
  contextFilters,
8488
8552
  contextContent,
8489
8553
  participantMap,
8490
8554
  scheduleTiming,
8555
+ publishStatus,
8491
8556
  contextProfile,
8492
8557
  drawDefinition,
8493
8558
  exitProfiles,
@@ -8508,13 +8573,15 @@ function getStructureMatchUps({
8508
8573
  afterRecoveryTimes,
8509
8574
  policyDefinitions,
8510
8575
  tournamentRecord,
8511
- drawDefinition,
8576
+ usePublishState,
8512
8577
  matchUpFilters,
8513
8578
  contextFilters,
8514
- contextProfile,
8515
8579
  contextContent,
8516
8580
  participantMap,
8517
8581
  scheduleTiming,
8582
+ publishStatus,
8583
+ contextProfile,
8584
+ drawDefinition,
8518
8585
  exitProfiles,
8519
8586
  matchUpsMap,
8520
8587
  structure,
@@ -8610,12 +8677,14 @@ function getDrawMatchUps(params) {
8610
8677
  afterRecoveryTimes,
8611
8678
  policyDefinitions,
8612
8679
  tournamentRecord,
8680
+ usePublishState,
8613
8681
  contextFilters,
8614
- contextProfile,
8615
- drawDefinition,
8616
8682
  matchUpFilters,
8617
8683
  scheduleTiming,
8618
8684
  participantMap,
8685
+ publishStatus,
8686
+ contextProfile,
8687
+ drawDefinition,
8619
8688
  nextMatchUps,
8620
8689
  inContext,
8621
8690
  context,
@@ -8670,9 +8739,11 @@ function getDrawMatchUps(params) {
8670
8739
  afterRecoveryTimes,
8671
8740
  policyDefinitions,
8672
8741
  tournamentRecord,
8742
+ usePublishState,
8743
+ contextContent,
8673
8744
  participantMap,
8674
8745
  scheduleTiming,
8675
- contextContent,
8746
+ publishStatus,
8676
8747
  contextProfile,
8677
8748
  drawDefinition,
8678
8749
  exitProfiles,
@@ -16496,8 +16567,7 @@ function tieFormatGenderValidityCheck(params) {
16496
16567
  context: { gender },
16497
16568
  stack
16498
16569
  });
16499
- const eventType = params.eventType ?? params.referenceEvent?.eventType;
16500
- if (referenceGender === MIXED && (eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
16570
+ if (referenceGender === MIXED && (gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
16501
16571
  return decorateResult({
16502
16572
  result: { error: INVALID_GENDER, valid: false },
16503
16573
  info: mixedGenderError,
@@ -16888,7 +16958,6 @@ function validateTieFormat(params) {
16888
16958
  const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
16889
16959
  referenceCategory: params.category,
16890
16960
  referenceGender: params.gender,
16891
- eventType: params.eventType,
16892
16961
  collectionDefinition,
16893
16962
  checkCollectionIds,
16894
16963
  checkCategory,
@@ -16940,7 +17009,6 @@ function validateCollectionDefinition({
16940
17009
  checkGender = true,
16941
17010
  referenceCategory,
16942
17011
  referenceGender,
16943
- eventType,
16944
17012
  event
16945
17013
  }) {
16946
17014
  referenceGender = referenceGender ?? event?.gender;
@@ -17008,7 +17076,6 @@ function validateCollectionDefinition({
17008
17076
  }
17009
17077
  if (checkGender) {
17010
17078
  const result = tieFormatGenderValidityCheck({
17011
- eventType: eventType ?? event?.eventType,
17012
17079
  referenceGender,
17013
17080
  matchUpType,
17014
17081
  gender
@@ -17041,12 +17108,10 @@ function validateCollectionDefinition({
17041
17108
  return { valid: true };
17042
17109
  }
17043
17110
  function checkTieFormat({
17044
- tieFormat,
17045
- eventType
17111
+ tieFormat
17046
17112
  }) {
17047
17113
  const result = validateTieFormat({
17048
17114
  checkCollectionIds: false,
17049
- eventType,
17050
17115
  tieFormat
17051
17116
  });
17052
17117
  if (result.error)
@@ -17273,7 +17338,7 @@ function generateTieMatchUpScore(params) {
17273
17338
  const tieFormat = resolveTieFormat({ matchUp, drawDefinition, structure, event })?.tieFormat || params?.tieFormat;
17274
17339
  if (!tieFormat)
17275
17340
  return { error: MISSING_TIE_FORMAT };
17276
- const result = validateTieFormat({ tieFormat, eventType: event?.eventType });
17341
+ const result = validateTieFormat({ tieFormat });
17277
17342
  if (result.error)
17278
17343
  return result;
17279
17344
  const collectionDefinitions = tieFormat?.collectionDefinitions || [];
@@ -18246,14 +18311,14 @@ function generateAndPopulatePlayoffStructures(params) {
18246
18311
  };
18247
18312
  }
18248
18313
 
18314
+ function getDrawPublishStatus({ drawDetails, drawId }) {
18315
+ const details = drawDetails?.[drawId]?.publishingDetail;
18316
+ return details?.published;
18317
+ }
18318
+
18249
18319
  function getEventPublishStatuses({ event }) {
18250
- const itemType = `${PUBLISH}.${STATUS}`;
18251
- const { timeItem } = getTimeItem({
18252
- element: event,
18253
- itemType
18254
- });
18255
- if (timeItem?.itemValue?.PUBLIC) {
18256
- const { drawIds: publishedDrawIds = [], seeding } = timeItem.itemValue.PUBLIC || {};
18320
+ const eventPubStatus = getEventPublishStatus({ event });
18321
+ if (eventPubStatus) {
18257
18322
  const publishedSeeding = {
18258
18323
  published: void 0,
18259
18324
  // seeding can be present for all entries in an event when no flights have been defined
@@ -18261,9 +18326,13 @@ function getEventPublishStatuses({ event }) {
18261
18326
  drawIds: []
18262
18327
  // seeding can be specific to drawIds
18263
18328
  };
18264
- if (seeding) {
18265
- Object.assign(publishedSeeding, timeItem.itemValue.PUBLIC.seeding);
18329
+ if (eventPubStatus.seeding) {
18330
+ Object.assign(publishedSeeding, eventPubStatus.seeding);
18266
18331
  }
18332
+ const { drawDetails, drawIds } = eventPubStatus;
18333
+ const publishedDrawIds = drawDetails && Object.keys(drawDetails).filter(
18334
+ (drawId) => getDrawPublishStatus({ drawDetails, drawId })
18335
+ ) || drawIds || [];
18267
18336
  return {
18268
18337
  publishedDrawIds,
18269
18338
  publishedSeeding
@@ -18386,6 +18455,10 @@ function getEventSeedAssignments({
18386
18455
  return eventSeedAssignments;
18387
18456
  }
18388
18457
 
18458
+ function stringSort(a, b) {
18459
+ return (a || "").localeCompare(b || "");
18460
+ }
18461
+
18389
18462
  function processEventEntry({
18390
18463
  convertExtensions,
18391
18464
  seedAssignments,
@@ -19257,7 +19330,7 @@ function getParticipantEntries(params) {
19257
19330
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
19258
19331
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
19259
19332
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
19260
- const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
19333
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join("|");
19261
19334
  participantAggregator.scheduleConflicts[key] = {
19262
19335
  priorScheduledMatchUpId: scheduleItem.matchUpId,
19263
19336
  matchUpIdWithConflict: consideredItem.matchUpId
@@ -20155,8 +20228,7 @@ function generateVoluntaryConsolation$1(params) {
20155
20228
  return { error: INVALID_DRAW_SIZE };
20156
20229
  let { tieFormat, matchUpType } = params;
20157
20230
  if (tieFormat) {
20158
- const eventType = params.event?.eventType;
20159
- const result2 = validateTieFormat({ tieFormat, eventType });
20231
+ const result2 = validateTieFormat({ tieFormat });
20160
20232
  if (result2.error)
20161
20233
  return result2;
20162
20234
  }
@@ -20392,10 +20464,6 @@ function addAdHocMatchUps({
20392
20464
  return { ...SUCCESS };
20393
20465
  }
20394
20466
 
20395
- function stringSort(a, b) {
20396
- return (a || "").localeCompare(b || "");
20397
- }
20398
-
20399
20467
  function generateCandidate({
20400
20468
  maxIterations = 4e3,
20401
20469
  // cap the processing intensity of the candidate generator
@@ -20857,10 +20925,11 @@ function generateQualifyingStructures({
20857
20925
  for (const structureProfile of (structureProfiles || []).sort(
20858
20926
  sequenceSort
20859
20927
  )) {
20860
- let drawSize = structureProfile.drawSize || coerceEven(structureProfile.participantsCount);
20928
+ let drawSize = coerceEven(
20929
+ structureProfile.drawSize || structureProfile.participantsCount
20930
+ );
20861
20931
  const {
20862
20932
  qualifyingRoundNumber,
20863
- qualifyingPositions,
20864
20933
  structureOptions,
20865
20934
  matchUpFormat,
20866
20935
  structureName,
@@ -20868,6 +20937,7 @@ function generateQualifyingStructures({
20868
20937
  drawType
20869
20938
  } = structureProfile;
20870
20939
  const matchUpType = structureProfile.matchUpType;
20940
+ const qualifyingPositions = structureProfile.qualifyingPositions || deriveQualifyingPositions({ drawSize, qualifyingRoundNumber });
20871
20941
  let roundLimit, structure, matchUps;
20872
20942
  if (!isConvertableInteger(drawSize)) {
20873
20943
  return decorateResult({
@@ -20974,6 +21044,15 @@ function generateQualifyingStructures({
20974
21044
  links
20975
21045
  };
20976
21046
  }
21047
+ function deriveQualifyingPositions({ drawSize, qualifyingRoundNumber }) {
21048
+ let qualifyingPositions = drawSize;
21049
+ let divisionsCount = 0;
21050
+ while (divisionsCount < qualifyingRoundNumber) {
21051
+ qualifyingPositions = Math.floor(qualifyingPositions / 2);
21052
+ divisionsCount += 1;
21053
+ }
21054
+ return qualifyingPositions;
21055
+ }
20977
21056
 
20978
21057
  function generateDrawStructuresAndLinks(params) {
20979
21058
  const {
@@ -21258,8 +21337,7 @@ function generateDrawTypeAndModifyDrawDefinition(params) {
21258
21337
  const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
21259
21338
  let { tieFormat, matchUpType } = params;
21260
21339
  if (tieFormat) {
21261
- const eventType = params.event?.eventType;
21262
- const result2 = validateTieFormat({ tieFormat, eventType });
21340
+ const result2 = validateTieFormat({ tieFormat });
21263
21341
  if (result2.error)
21264
21342
  return result2;
21265
21343
  }
@@ -23744,8 +23822,7 @@ function generateDrawDefinition(params) {
23744
23822
  const result = validateTieFormat({
23745
23823
  gender: event?.gender,
23746
23824
  enforceGender,
23747
- tieFormat,
23748
- event
23825
+ tieFormat
23749
23826
  });
23750
23827
  if (result.error)
23751
23828
  return decorateResult({ result, stack });
@@ -23764,10 +23841,7 @@ function generateDrawDefinition(params) {
23764
23841
  const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
23765
23842
  if (!equivalentInScope) {
23766
23843
  if (tieFormat) {
23767
- const result = checkTieFormat({
23768
- eventType: event.eventType,
23769
- tieFormat
23770
- });
23844
+ const result = checkTieFormat({ tieFormat });
23771
23845
  if (result.error)
23772
23846
  return decorateResult({ result, stack });
23773
23847
  drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
@@ -24098,7 +24172,7 @@ function generateDrawDefinition(params) {
24098
24172
  drawDefinition.links.push(link);
24099
24173
  }
24100
24174
  drawDefinition.drawName = params.drawName ?? (drawType && constantToString(drawType));
24101
- if (typeof voluntaryConsolation === "object") {
24175
+ if (typeof voluntaryConsolation === "object" && drawSize >= 4) {
24102
24176
  addVoluntaryConsolationStructure({
24103
24177
  ...voluntaryConsolation,
24104
24178
  tournamentRecord,